Double return is printed
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
Research direction
Start with the minimal Python example and the bytecode_3.8/00_double_return.pyc case generated using add-test.py. Reproduce the decompilation on Python 3.8 and inspect the relevant return-handling path to find why return and return None are emitted together. Done means the output contains only return and the regression case confirms the expected decompilation.
Written by the indexing model from the issue text.
Description
Description
double return get printed
How to Reproduce
def main():
if input() == 0:
print("0")
return
if input() == 1:
print("1")
else:
printf("other")
https://github.com/rocky/python-uncompyle6/pull/458
I used add-test.py with python3.8 with the latest commit on the respective branch
Output Given
# uncompyle6 version 3.9.1.dev0
# Python bytecode version base 3.8.0 (3413)
# Decompiled from: Python 3.8.10 (default, Mar 13 2023, 10:26:41)
# [GCC 9.4.0]
# Embedded file name: 00_double_return.py
# Compiled at: 2023-05-31 12:07:25
# Size of source mod 2**32: 118 bytes
def main():
if input() == 0:
print('0')
return return None
elif input() == 1:
print('1')
else:
printf('other')
# okay decompiling bytecode_3.8/00_double_return.pyc
Expected behavior
def main():
if input() == 0:
print('0')
+ return
- return return None
elif input() == 1:
print('1')
else:
printf('other')
Environment
- Uncompyle6 version: output from
uncompyle6 --versionuncompyle6 3.9.1.dev0 - Python version for the version of Python the byte-compiled the file:
python -c "import sys; print(sys.version)"wherepythonis the correct CPython or PyPy binary.
3.8.10 (default, Mar 13 2023, 10:26:41)
[GCC 9.4.0] - OS and Version: Linux codespaces-6db051 5.15.0-1038-azure #45-Ubuntu SMP Mon Apr 24 15:40:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Workarounds
Remove the second run by hand
Priority
I found it while trying to reduce another bug
Additional Context
N/A
- Dominant language
- Python
- Stars
- 4.3k
- Forks
- 463
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rocky/python-uncompyle6
-
Works on decompyle3
Difficulty 4/5 3-5 days Newbie friendliness 35/100
rocky/python-uncompyle6#506 · 1 comment ·
-
Python 3.8 Volunteer wanted Works on decompyle3
Difficulty 4/5 3-5 days Newbie friendliness 35/100
rocky/python-uncompyle6#492 · 4 comments ·
-
Redundant "else:" OpenControl Flow Python 3.8 Volunteer wanted Works on decompyle3
Difficulty 4/5 3-5 days Newbie friendliness 45/100
rocky/python-uncompyle6#486 ·
-
Missing "While True" OpenControl Flow Python 3.8 Volunteer wanted Works on decompyle3
Difficulty 4/5 3-5 days Newbie friendliness 45/100
rocky/python-uncompyle6#485 · 4 comments ·
-
Duplicate Python 3.9+
Difficulty 5/5 Over a week Newbie friendliness 25/100
rocky/python-uncompyle6#484 · 9 reactions ·
All issues in rocky/python-uncompyle6
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ClickHouse/clickhouse-connect#1057 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
open-telemetry/sig-end-user#406 ·
-
bug ci good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100