Fix more Python3.2 parser errors

This commit is contained in:
rocky
2017-05-06 05:25:56 -04:00
parent 4e9555a7f6
commit 4a47822904
6 changed files with 21 additions and 1 deletions

Binary file not shown.

BIN
test/bytecode_3.2/03_if.pyc Normal file

Binary file not shown.

View File

@@ -0,0 +1,9 @@
# From 3.2 _abcoll.py
def pop(self):
it = iter(self)
try:
value = next(it)
except StopIteration:
raise KeyError
self.discard(value)
return value

View File

@@ -0,0 +1,11 @@
# From 3.2 shlex.py
def _samefile(os, src, dst):
if hasattr(os.path, 'samefile'):
try:
return os.path.samefile(src, dst)
except OSError:
return False
# All other platforms: check for same pathname.
return (os.path.normcase(os.path.abspath(src)) ==
os.path.normcase(os.path.abspath(dst)))

View File

@@ -27,6 +27,7 @@ class Python32Parser(Python3Parser):
# JUMP_FORWARD in some cases, and hence we also don't
# see COME_FROM
_ifstmts_jump ::= c_stmts_opt
_ifstmts_jump ::= c_stmts_opt JUMP_FORWARD _come_from
stmt ::= del_deref_stmt
del_deref_stmt ::= DELETE_DEREF

View File

@@ -20,7 +20,6 @@ class Python33Parser(Python32Parser):
iflaststmt ::= testexpr c_stmts_opt33
c_stmts_opt33 ::= JUMP_BACK JUMP_ABSOLUTE c_stmts_opt
_ifstmts_jump ::= c_stmts_opt JUMP_FORWARD _come_from
# Python 3.5+ has jump optimization to remove the redundant
# jump_excepts. But in 3.3 we need them added