wibiti/uncompyle2 — Issue #16: new issue as of last revision
Author: bloodyshade
Created: 2012-03-03 23:36:44+00:00
State: open

Hi,

Sorry to bother again but I found a new issue with the latest revision:
in distutils/dep_util.py, method newer_group is failing to decompile

def newer_group--- This code section failed: ---
0	LOAD_GLOBAL 'os'
3	LOAD_ATTR 'path'
6	LOAD_ATTR 'exists'
9	LOAD_FAST 'target'
12	CALL_FUNCTION_1 None
15	POP_JUMP_IF_TRUE '22'

18	LOAD_GLOBAL 'True'
21	RETURN_VALUE None

22	LOAD_GLOBAL 'os'
25	LOAD_ATTR 'stat'
28	LOAD_FAST 'target'
31	CALL_FUNCTION_1 None
34	LOAD_ATTR 'st_mtime'
37	STORE_FAST 'target_mtime'

40	SETUP_LOOP '155'
43	LOAD_FAST 'sources'
46	GET_ITER None
47	FOR_ITER '154'
50	STORE_FAST 'source'

53	LOAD_GLOBAL 'os'
56	LOAD_ATTR 'path'
59	LOAD_ATTR 'exists'
62	LOAD_FAST 'source'
65	CALL_FUNCTION_1 None
68	POP_JUMP_IF_TRUE '123'

71	LOAD_FAST 'missing'
74	LOAD_CONST 'error'
77	COMPARE_OP '=='
80_0	COME_FROM '68'
80	POP_JUMP_IF_FALSE '86'

83	JUMP_ABSOLUTE '123'

86	LOAD_FAST 'missing'
89	LOAD_CONST 'ignore'
92	COMPARE_OP '=='
95	POP_JUMP_IF_FALSE '104'

98	CONTINUE '47'
101	JUMP_ABSOLUTE '123'

104	LOAD_FAST 'missing'
107	LOAD_CONST 'newer'
110	COMPARE_OP '=='
113	POP_JUMP_IF_FALSE '123'

116	LOAD_GLOBAL 'True'
119	RETURN_VALUE None
120	JUMP_FORWARD '123'
123_0	COME_FROM '120'

123	LOAD_GLOBAL 'os'
126	LOAD_ATTR 'stat'
129	LOAD_FAST 'source'
132	CALL_FUNCTION_1 None
135	LOAD_ATTR 'st_mtime'
138	LOAD_FAST 'target_mtime'
141	COMPARE_OP '>'
144	POP_JUMP_IF_FALSE '47'

147	LOAD_GLOBAL 'True'
150	RETURN_VALUE None
151	JUMP_BACK '47'
154	POP_BLOCK None
155_0	COME_FROM '40'

155	LOAD_GLOBAL 'False'
158	RETURN_VALUE None
-1	RETURN_LAST None

Syntax error at or near `LOAD_FAST' token at offset 86

The actual code is this:

def newer_group(sources, target, missing='error'):
"""Return true if 'target' is out-of-date with respect to any file
listed in 'sources'.

In other words, if 'target' exists and is newer
than every file in 'sources', return false; otherwise return true.
'missing' controls what we do when a source file is missing; the
default ("error") is to blow up with an OSError from inside 'stat()';
if it is "ignore", we silently drop any missing source files; if it is
"newer", any missing source files make us assume that 'target' is
out-of-date (this is handy in "dry-run" mode: it'll make you pretend to
carry out commands that wouldn't work because inputs are missing, but
that doesn't matter because you're not actually going to run the
commands).
"""
# If the target doesn't even exist, then it's definitely out-of-date.
if not os.path.exists(target):
return True

# Otherwise we have to find out the hard way: if *any* source file
# is more recent than 'target', then 'target' is out-of-date and
# we can immediately return true. If we fall through to the end
# of the loop, then 'target' is up-to-date and we return false.
target_mtime = os.stat(target).st_mtime

for source in sources:
if not os.path.exists(source):
if missing == 'error': # blow up when we stat() the file
pass
elif missing == 'ignore': # missing source dropped from
continue # target's dependency list
elif missing == 'newer': # missing source means target is
return True # out-of-date

if os.stat(source).st_mtime > target_mtime:
return True

return False

Best regards,
Luis Henrique