wibiti/uncompyle2 — Issue #4: Problem uncompiling 
Author: lblanquet
Created: 2011-12-10 11:59:41+00:00
State: open

Hello,

I have the following portion of code I submitted to uncompyle2 :

def _get_by_key(self,key,return_guid=True):
try:
# print '>>get_by_key SELECT'
result=self.table.select(getattr(self.table.c,self.key)==key).execute().fetchall()
# print '<0 and result[0] is not None:
result=self._dict(result[0])
self._data_key[key]=result
else:
result=None
except:
# print 'EXCEPT GET_BY_KEY %s' % traceback.format_exc()
result=None
return result['_guid'] if return_guid and result is not None else result

and the result was :

def _get_by_key--- This code section failed: ---
0 SETUP_EXCEPT '136'
3 LOAD_FAST 'self'
6 LOAD_ATTR 'table'
9 LOAD_ATTR 'select'
12 LOAD_GLOBAL 'getattr'
15 LOAD_FAST 'self'
18 LOAD_ATTR 'table'
21 LOAD_ATTR 'c'
24 LOAD_FAST 'self'
27 LOAD_ATTR 'key'
30 CALL_FUNCTION_2 ''
33 LOAD_FAST 'key'
36 COMPARE_OP '=='
39 CALL_FUNCTION_1 ''
42 LOAD_ATTR 'execute'
45 CALL_FUNCTION_0 ''
48 LOAD_ATTR 'fetchall'
51 CALL_FUNCTION_0 ''
54 STORE_FAST 'result'
57 LOAD_GLOBAL 'len'
60 LOAD_FAST 'result'
63 CALL_FUNCTION_1 ''
66 LOAD_CONST ''
69 COMPARE_OP '>'
72 POP_JUMP_IF_FALSE '126'
75 LOAD_FAST 'result'
78 LOAD_CONST ''
81 BINARY_SUBSCR ''
82 LOAD_CONST ''
85 COMPARE_OP 'is not'
88_0 COME_FROM '72'
88 POP_JUMP_IF_FALSE '126'
91 LOAD_FAST 'self'
94 LOAD_ATTR '_dict'
97 LOAD_FAST 'result'
100 LOAD_CONST ''
103 BINARY_SUBSCR ''
104 CALL_FUNCTION_1 ''
107 STORE_FAST 'result'
110 LOAD_FAST 'result'
113 LOAD_FAST 'self'
116 LOAD_ATTR '_data_key'
119 LOAD_FAST 'key'
122 STORE_SUBSCR ''
123 JUMP_FORWARD '132'
126 LOAD_CONST ''
129 STORE_FAST 'result'
132_0 COME_FROM '123'
132 POP_BLOCK ''
133 JUMP_FORWARD '149'
136_0 COME_FROM '0'
136 POP_TOP ''
137 POP_TOP ''
138 POP_TOP ''
139 LOAD_CONST ''
142 STORE_FAST 'result'
145 JUMP_FORWARD '149'
148 END_FINALLY ''
149_0 COME_FROM '133'
149_1 COME_FROM '145'
149 LOAD_FAST 'return_guid'
152 POP_JUMP_IF_FALSE '175'
155 LOAD_FAST 'result'
158 LOAD_CONST ''
161 COMPARE_OP 'is not'
164 POP_JUMP_IF_FALSE '175'
167 LOAD_FAST 'result'
170 LOAD_CONST '_guid'
173 BINARY_SUBSCR ''
174 RETURN_VALUE ''
175 LOAD_FAST 'result'
178 RETURN_VALUE ''
-1 RETURN_LAST ''

Syntax error at or near `RETURN_VALUE' token at offset 178