chen44 / unpyc

Automatically exported from code.google.com/p/unpyc
0 stars 0 forks source link

IMPORT_FROM only takes one LOAD_ATTR #9

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
decompiling a program that uses:

import a.b.c.d as e

will fail, because the code expects no more then one LOAD_ATTR after a 
IMPORT_FROM statement.

A work around is to add the following, up to the number of LOAD_ATTR lines you 
are seeing - I don't currently see a way to tell unpyc to accept any number of 
them.  Starting at line 189 in Parser.py, add:
import_as ::= IMPORT_NAME LOAD_ATTR LOAD_ATTR designator
import_as ::= IMPORT_NAME LOAD_ATTR LOAD_ATTR LOAD_ATTR designator

etc, etc, etc

Yes, I know this doesn't fit the 0,1,n pattern, but it is a quick fix.

Original issue reported on code.google.com by lok...@gmail.com on 12 Aug 2010 at 5:12