rocky / python-uncompyle6

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

Wrong import in Python 2.7.18 #448

Closed andrem-eberle closed 1 year ago

andrem-eberle commented 1 year ago

Description

Certain imports in Python 2.7 are being decompiled wrong

How to Reproduce

Input file.py:

"""a doc"""

from contextlib import *
python2.7 -m compileall file.py && python3.8 uncompyle6 file.pyc

Output Given

__doc__ = 'a doc'
from .contextlib import *

It adds a relative import to contextlib which shouldn't be there.

Expected behavior

Correct import line

Environment

Python 2.7.18 for compileall Python 3.8.16 for uncompyle6 Ubuntu 16.0x

rocky commented 1 year ago

Fixed by #449