rocky / python-uncompyle6

A cross-version Python bytecode decompiler
GNU General Public License v3.0
3.74k stars 408 forks source link

Loss of long modifier in Python 2.7.18 #447

Closed andrem-eberle closed 1 year ago

andrem-eberle commented 1 year ago

Description

Long modifier 'L' on number is being lost after decompiling.

How to Reproduce

Input file file.py:

v = 10L
python2.7 -m compileall file.py
uncompyle6 file.pyc

Output:

v = 10

L modifier is gone

Expected behavior

L modifier included in the number

Environment

Python 3.8.16 for uncompyle6 Python 2.7.18 for compileall Ubuntu 16.0x

rocky commented 1 year ago

This is not a bug in this code base per se - no code needs to be changed here.

The problem is in xdis the cross disassembler and arises because Python 3 does not a "long" type nor needs to distinguish it from int.

https://github.com/rocky/python-xdis/pull/103 fixes this problem.