Error when decompiling loop inside if-else
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- python
- Área
- compilers, reverse-engineering
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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!
- Lenguaje dominante
- Python
- Estrellas
- 4.3k
- Forks
- 464
- Merge medio
- 10 h 7 min
- PR fusionados (30 d)
- 1
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de rocky/python-uncompyle6
-
Works on decompyle3
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
rocky/python-uncompyle6#506 · 1 comentario ·
-
Python 3.8 Volunteer wanted Works on decompyle3
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
rocky/python-uncompyle6#492 · 4 comentarios ·
-
Redundant "else:"AbiertoControl Flow Python 3.8 Volunteer wanted Works on decompyle3
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
rocky/python-uncompyle6#486 ·
-
Missing "While True"AbiertoControl Flow Python 3.8 Volunteer wanted Works on decompyle3
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
rocky/python-uncompyle6#485 · 4 comentarios ·
-
Duplicate Python 3.9+
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
rocky/python-uncompyle6#484 · 9 reacciones ·
Todos los issues de rocky/python-uncompyle6
Issues similares
-
SSM GetParameter throttling during concurrent workflow launchesPosiblemente ocupada @alexiswl la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
-
[Bug] Dev image build fails: `npm install` in the root Dockerfile runs out of memory (exit 134)Posiblemente ocupada @andest01 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
pesu-dev/discord_bot#97 ·
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
gradio-app/gradio#13964 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 93/100
BSData/horus-heresy-3rd-edition#3232 · 1 comentario ·
Los mantenedores suelen responder en 1 día