Python 3.5 abc.py bug distilled

This commit is contained in:
rocky
2016-05-05 04:11:53 -04:00
parent 6765a2ea97
commit 05733c6171
5 changed files with 21 additions and 1 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,14 @@
# Python3.5 bug from abc.py:
# stmt ::= LOAD_CLOSURE RETURN_VALUE RETURN_LAST
#
# And this gets ignored.
# Note this is similar to 06_classbug.py but not the same.
# classmethod -> object
class abstractclassmethod(classmethod):
__isabstractmethod__ = True
def __init__(self, callable):
callable.__isabstractmethod__ = True
super().__init__(callable)

View File

@@ -5,6 +5,9 @@
# LOAD_FAST '__locals__'
# STORE_LOCALS ''
# Note this is similar to 05_abc_class.py but not the same:
# object -> classmethod
class abstractclassmethod(object):
"""A Python 3.2 STORE_LOCALS bug
"""

View File

@@ -545,7 +545,7 @@ class Python35onParser(Python3Parser):
# this optimization is only used in Python 3.5 and beyond
_ifstmts_jump ::= c_stmts_opt
# Python 3.5 has WITH_CLEANUP_START/FINISH
# Python 3.5+ has WITH_CLEANUP_START/FINISH
withstmt ::= expr SETUP_WITH with_setup suite_stmts_opt
POP_BLOCK LOAD_CONST COME_FROM
WITH_CLEANUP_START WITH_CLEANUP_FINISH END_FINALLY
@@ -553,6 +553,9 @@ class Python35onParser(Python3Parser):
withasstmt ::= expr SETUP_WITH designator suite_stmts_opt
POP_BLOCK LOAD_CONST COME_FROM
WITH_CLEANUP_START WITH_CLEANUP_FINISH END_FINALLY
# Python 3.5+ classes seem to end with this:
stmt ::= LOAD_CLOSURE RETURN_VALUE RETURN_LAST
"""
class Python35onParserSingle(Python35onParser, PythonParserSingle):