Error when decompiling loop inside if-else
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- python
- Domaine
- compilers, reverse-engineering
Piste de recherche
Reproduce the issue from the shown code.py by running python3 -m compileall . and decompiling the generated Python 3.8 pyc. Start by tracing how the decompiler handles the JUMP_FORWARD at offset 10 and its COME_FROM entries; done means the loop inside the if-else decompiles without a parse error.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
I was trying to decompile a pyc that I had, but it had a few errors. I managed to manually decompile it though and narrowed it down to code that looks like this:
def func(val):
if val == 0:
while True:
pass
else:
pass
When I compile this with python3 -m compileall . and then attempt to decompile, I get a 'parse error':
# uncompyle6 version 3.7.2
# Python bytecode 3.8 (3413)
# Decompiled from: Python 3.7.7 (default, Jun 28 2020, 13:00:53)
# [GCC 9.3.0]
# Embedded file name: ./code.py
# Compiled at: 2020-06-28 16:30:43
# Size of source mod 2**32: 92 bytes
Instruction context:
L. 4 8 JUMP_BACK 8 'to 8'
-> 10 JUMP_FORWARD 12 'to 12'
12_0 COME_FROM 10 '10'
def func--- This code section failed: ---
L. 2 0 LOAD_FAST 'val'
2 LOAD_CONST 0
4 COMPARE_OP ==
6 POP_JUMP_IF_FALSE 12 'to 12'
L. 4 8 JUMP_BACK 8 'to 8'
10 JUMP_FORWARD 12 'to 12'
12_0 COME_FROM 10 '10'
12_1 COME_FROM 6 '6'
Parse error at or near `JUMP_FORWARD' instruction at offset 10
# file __pycache__/code.cpython-38.pyc
# Deparsing stopped due to parse error
Here is the disassembly of that code:
1 0 LOAD_CONST 0 (<code object func at 0x7ffac2d20b30, file "code.py", line 1>)
2 LOAD_CONST 1 ('func')
4 MAKE_FUNCTION 0
6 STORE_NAME 0 (func)
8 LOAD_CONST 2 (None)
10 RETURN_VALUE
Disassembly of <code object func at 0x7ffac2d20b30, file "code.py", line 1>:
2 0 LOAD_FAST 0 (val)
2 LOAD_CONST 1 (0)
4 COMPARE_OP 2 (==)
6 POP_JUMP_IF_FALSE 12
4 >> 8 JUMP_ABSOLUTE 8
10 JUMP_FORWARD 0 (to 12)
6 >> 12 LOAD_CONST 0 (None)
14 RETURN_VALUE
Hopefully this issue can be fixed!
- Langage dominant
- Python
- Étoiles
- 4.3k
- Forks
- 465
- Merge moyen
- 4 j 11 h
- PR mergées (30 j)
- 3
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de rocky/python-uncompyle6
-
Works on decompyle3
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
rocky/python-uncompyle6#506 · 1 commentaire ·
-
Python 3.8 Volunteer wanted Works on decompyle3
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
rocky/python-uncompyle6#492 · 4 commentaires ·
-
Redundant "else:"OuverteControl Flow Python 3.8 Volunteer wanted Works on decompyle3
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
rocky/python-uncompyle6#486 ·
-
Missing "While True"OuverteControl Flow Python 3.8 Volunteer wanted Works on decompyle3
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
rocky/python-uncompyle6#485 · 4 commentaires ·
-
Duplicate Python 3.9+
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
rocky/python-uncompyle6#484 · 9 réactions ·
Toutes les issues de rocky/python-uncompyle6
Issues similaires
-
Project submission:Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 72/100
slavakurilyak/awesome-ai-agents#845 ·
Les mainteneurs répondent en général sous 1 jour
-
tests: pin that the atomic writers in utils/paths.py stage the temporary file in the target's directoryPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouvertedifficulty:2 enhancement good first issue
Difficulté 1/5 1-3 heures Accessibilité débutants 92/100
MakazhanAlpamys/Soup#2178 ·
Les mainteneurs répondent en général sous 1 jour
-
[BUG] dcg.waggr permutation p-values are folded twice, so near-zero scores get the smallest p-valuesOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
scverse/rapids-singlecell#854 ·
Les mainteneurs répondent en général sous 1 jour
-
Slang input: int8_t4_packed and uint8_t4_packed are copied into CrossGLPeut-être pris @ninglinLiu l’a pris aujourd’hui. Ouvertearea:frontend backend:slang bug direction:input
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Les mainteneurs répondent en général sous 1 jour
-
random_elements(unique=True) on an OrderedDict: ZeroDivisionError once only zero weights remain, AssertionError with use_weighting=FalsePeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
Les mainteneurs répondent en général sous 13 jours