Redundant "else:"
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Run the supplied Python reproducer through uncompyle6 and compare the result with the reported output. Trace the decompiler’s handling of the loop and its else clause; done means the output no longer emits a redundant else while preserving the trailing time.sleep(0.5).
Written by the indexing model from the issue text.
Description
Description
a redundant "else:" will be printed
How to Reproduce
import time
L = ["a", "s"]
def thread():
for c in L:
if c == 'a':
print(c)
break
time.sleep(0.5)
Output Given
# uncompyle6 version 3.9.1.dev0
# Python bytecode version base 3.8.0 (3413)
# Decompiled from: Python 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]
# Embedded file name: simple.py
# Compiled at: 2024-03-05 23:58:49
# Size of source mod 2**32: 145 bytes
import time
L = ["a", "s"]
def thread():
for c in L:
if c == "a":
print(c)
break
else:
time.sleep(0.5)
Expected behavior
def thread():
for c in L:
if c == "a":
print(c)
break
+ time.sleep(0.5)
- else:
- time.sleep(0.5)
Environment
- Uncompyle6 version: output from
uncompyle6 --versionuncompyle6 3.9.1.dev0 - xdis version: output from
pydisasm --versionpydisasm, version 6.1.0.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 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] - OS and Version: Windows 11 (23H2)
- 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 ·
-
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 ·
-
Bug Python 3.8 Volunteer wanted Works on decompyle3
Difficulty 3/5 1-2 days Newbie friendliness 42/100
rocky/python-uncompyle6#459 · 3 comments ·
All issues in rocky/python-uncompyle6
Similar issues
-
triage/confirmed
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
Difficulty 1/5 Under an hour Newbie friendliness 92/100
NousResearch/hermes-agent#118866 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
apache/cloudstack#14222 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100