You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 09:22:40 +08:00
come_from_opt handles and/or precidence properly
main.py: give a better error message when file is not found.
This commit is contained in:
BIN
test/bytecode_3.5/10-list-ifnot.pyc
Normal file
BIN
test/bytecode_3.5/10-list-ifnot.pyc
Normal file
Binary file not shown.
17
test/simple_source/comprehension/10-list-ifnot.py
Normal file
17
test/simple_source/comprehension/10-list-ifnot.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Test semantic handling of
|
||||||
|
# [x for x in names if not y]
|
||||||
|
import os
|
||||||
|
|
||||||
|
def bug(dirname, pattern):
|
||||||
|
if not dirname:
|
||||||
|
if isinstance(pattern, bytes):
|
||||||
|
dirname = bytes(os.curdir, 'ASCII')
|
||||||
|
else:
|
||||||
|
dirname = os.curdir
|
||||||
|
try:
|
||||||
|
names = os.listdir(dirname)
|
||||||
|
except os.error:
|
||||||
|
return []
|
||||||
|
if not _ishidden(pattern):
|
||||||
|
names = [x for x in names if not _ishidden(x)]
|
||||||
|
return fnmatch.filter(names, pattern)
|
@@ -94,6 +94,11 @@ def main(in_base, out_base, files, codes, outfile=None,
|
|||||||
|
|
||||||
for filename in files:
|
for filename in files:
|
||||||
infile = os.path.join(in_base, filename)
|
infile = os.path.join(in_base, filename)
|
||||||
|
if not os.path.exists(infile):
|
||||||
|
sys.stderr.write("File '%s' doesn't exist. Skipped\n"
|
||||||
|
% infile)
|
||||||
|
continue
|
||||||
|
|
||||||
# print (infile, file=sys.stderr)
|
# print (infile, file=sys.stderr)
|
||||||
|
|
||||||
if of: # outfile was given as parameter
|
if of: # outfile was given as parameter
|
||||||
|
@@ -223,9 +223,16 @@ class PythonParser(GenericASTBuilder):
|
|||||||
list_iter ::= list_if_not
|
list_iter ::= list_if_not
|
||||||
list_iter ::= lc_body
|
list_iter ::= lc_body
|
||||||
|
|
||||||
|
# Zero or more COME_FROM
|
||||||
|
# loops can have this
|
||||||
_come_from ::= _come_from COME_FROM
|
_come_from ::= _come_from COME_FROM
|
||||||
_come_from ::=
|
_come_from ::=
|
||||||
|
|
||||||
|
# Zero or one COME_FROM
|
||||||
|
# And/or expressions have this
|
||||||
|
come_from_opt ::= COME_FROM
|
||||||
|
come_from_opt ::=
|
||||||
|
|
||||||
list_if ::= expr jmp_false list_iter
|
list_if ::= expr jmp_false list_iter
|
||||||
list_if_not ::= expr jmp_true list_iter
|
list_if_not ::= expr jmp_true list_iter
|
||||||
|
|
||||||
@@ -337,8 +344,8 @@ class PythonParser(GenericASTBuilder):
|
|||||||
_mklambda ::= mklambda
|
_mklambda ::= mklambda
|
||||||
|
|
||||||
or ::= expr JUMP_IF_TRUE_OR_POP expr COME_FROM
|
or ::= expr JUMP_IF_TRUE_OR_POP expr COME_FROM
|
||||||
or ::= expr jmp_true expr _come_from
|
or ::= expr jmp_true expr come_from_opt
|
||||||
and ::= expr jmp_false expr _come_from
|
and ::= expr jmp_false expr come_from_opt
|
||||||
and ::= expr JUMP_IF_FALSE_OR_POP expr COME_FROM
|
and ::= expr JUMP_IF_FALSE_OR_POP expr COME_FROM
|
||||||
and2 ::= _jump jmp_false COME_FROM expr COME_FROM
|
and2 ::= _jump jmp_false COME_FROM expr COME_FROM
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user