"if else" condition generates "uncompyle6.semantics.pysource.SourceWalkerError: Deparsing stopped due to parse error"
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- reverse-engineering
Research direction
Reproduce the issue by compiling the shown test.py with py_compile and running uncompyle6.decompile_file on the resulting Python 3.7 .pyc. Start by tracing the handling of the nested if/else bytecode around the COME_FROM instruction and SourceWalkerError. Done means this example decompiles without a parse error while retaining the conditional branches.
Written by the indexing model from the issue text.
Description
If you compile this test.py into a .pyc (with import py_compile; py_compile.compile("test.py")):
def f():
L = []
if len(L) > 1:
if 1:
pass
else:
pass
else:
pass
then decompiling it with uncompyle6 with
with open('test_decompiled.py', 'w') as f:
uncompyle6.decompile_file(r'__pycache__\test.cpython-37.pyc', f)
generates this error:
uncompyle6.semantics.pysource.SourceWalkerError: Deparsing stopped due to parse error
Here is the full error:
# uncompyle6 version 3.7.1
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit (AMD64)]
# Embedded file name: test-class.py
# Compiled at: 2020-06-16 19:00:25
# Size of source mod 2**32: 131 bytes
def f--- This code section failed: ---
L. 2 0 BUILD_LIST_0 0
2 STORE_FAST 'L'
L. 3 4 LOAD_GLOBAL len
6 LOAD_FAST 'L'
8 CALL_FUNCTION_1 1 '1 positional argument'
10 LOAD_CONST 1
12 COMPARE_OP >
14 POP_JUMP_IF_FALSE 18 'to 18'
L. 5 16 JUMP_FORWARD 18 'to 18'
18_0 COME_FROM 16 '16'
18_1 COME_FROM 14 '14'
Parse error at or near `COME_FROM' instruction at offset 18_0
- 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 78/100
syfoud/Simulated_Scepter#172 ·
-
A cancelled tests run makes the coverage comment workflow fail and reports it as a red check on main Openarea: ci bug perceived difficulty: 3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Nitjsefnie-Harness-Commons/daedalus#921 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ClickHouse/clickhouse-connect#1057 ·