Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem with lambda & list comprehension #5

Open
astrand opened this issue Aug 24, 2012 · 0 comments
Open

problem with lambda & list comprehension #5

astrand opened this issue Aug 24, 2012 · 0 comments

Comments

@astrand
Copy link
Owner

astrand commented Aug 24, 2012

Moved from http://bugzilla.lysator.liu.se/show_bug.cgi?id=1603:

Dear Sirs:

the following Python code line

f = lambda x: [v for v in x]

does not get through the pyobfuscate and generates an error when compiled (see below traceback
report).
Best regards,

Marco Lombardi


Traceback (most recent call last):
File "/Users/mlombard/bin/pyobfuscate", line 1101, in ?
main()
File "/Users/mlombard/bin/pyobfuscate", line 1078, in main
cw = CSTWalker(source_no_encoding, pae.pubapi)
File "/Users/mlombard/bin/pyobfuscate", line 125, in init
self.walk(elements, [self.symtab])
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 211, in walk
self.handle_lambdef(elements, symtabs)
File "/Users/mlombard/bin/pyobfuscate", line 633, in handle_lambdef
self.walk(node, symtabs + [lambdatab])
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 187, in walk
self.handle_power(elements, symtabs)
File "/Users/mlombard/bin/pyobfuscate", line 662, in handle_power
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 203, in walk
self.handle_atom(elements, symtabs)
File "/Users/mlombard/bin/pyobfuscate", line 476, in handle_atom
self.walk(node, symtabs)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 214, in walk
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 187, in walk
self.handle_power(elements, symtabs)
File "/Users/mlombard/bin/pyobfuscate", line 662, in handle_power
self.walk(node, symtabs, functioncall)
File "/Users/mlombard/bin/pyobfuscate", line 203, in walk
self.handle_atom(elements, symtabs)
File "/Users/mlombard/bin/pyobfuscate", line 431, in handle_atom
s = tab.lookup(id)
File "/Users/mlombard/bin/pyobfuscate", line 107, in lookup
return self.symtabs[0].lookup(name)
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/symtable.py", line 107, in
lookup
flags = self._table.symbols[name]
KeyError: 'v'

tyl12 pushed a commit to tyl12/pyobfuscate that referenced this issue Nov 29, 2013
…-line

comment.

For below codeing style:
-------------------------------
1.   '''
2.   xxx
3.   xxx
4.   '''
5.
6.   some def A
7.   some def B
-------------------------------
line astrand#1 will be multi-pending lines, line astrand#5 will be 'tokenize.NL',
and 'tokennize.NEWLINE' will occur at end of line astrand#6 (before line astrand#7).
so the origin code will obfuscate it to below wrong style.
-------------------------------
1.   some def A
2.   no_op_line
3.   no_op_line
4.   no_op_line
5.   no_op_line
7.   some def B
-------------------------------
it will cause error when handling decorator expression.

Signed-off-by: Teng Yiliang <yiliang.teng@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant