You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Handle class with one kwarg subclass
This commit is contained in:
@@ -37,6 +37,7 @@ check-3.0: check-bytecode
|
|||||||
#: Run working tests from Python 3.1
|
#: Run working tests from Python 3.1
|
||||||
check-3.1: check-bytecode
|
check-3.1: check-bytecode
|
||||||
$(PYTHON) test_pythonlib.py --bytecode-3.1 --weak-verify $(COMPILE)
|
$(PYTHON) test_pythonlib.py --bytecode-3.1 --weak-verify $(COMPILE)
|
||||||
|
$(PYTHON) test_pythonlib.py --bytecode-3.1-run --verify-run
|
||||||
|
|
||||||
#: Run working tests from Python 3.2
|
#: Run working tests from Python 3.2
|
||||||
check-3.2: check-bytecode
|
check-3.2: check-bytecode
|
||||||
@@ -201,6 +202,7 @@ check-bytecode-3.0:
|
|||||||
#: Check deparsing Python 3.1
|
#: Check deparsing Python 3.1
|
||||||
check-bytecode-3.1:
|
check-bytecode-3.1:
|
||||||
$(PYTHON) test_pythonlib.py --bytecode-3.1 --weak-verify
|
$(PYTHON) test_pythonlib.py --bytecode-3.1 --weak-verify
|
||||||
|
$(PYTHON) test_pythonlib.py --bytecode-3.1-run --verify-run
|
||||||
|
|
||||||
#: Check deparsing Python 3.2
|
#: Check deparsing Python 3.2
|
||||||
check-bytecode-3.2:
|
check-bytecode-3.2:
|
||||||
|
BIN
test/bytecode_3.1_run/05_abc_test.pyc
Normal file
BIN
test/bytecode_3.1_run/05_abc_test.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.2_run/05_abc_test.pyc
Normal file
BIN
test/bytecode_3.2_run/05_abc_test.pyc
Normal file
Binary file not shown.
BIN
test/bytecode_3.4_run/05_abc_test.pyc
Normal file
BIN
test/bytecode_3.4_run/05_abc_test.pyc
Normal file
Binary file not shown.
18
test/simple_source/bug31/05_abc_test.py
Normal file
18
test/simple_source/bug31/05_abc_test.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Extracted from Python 3.5 test_abc.py
|
||||||
|
# Bug is class having only a single kwarg
|
||||||
|
# subclass.
|
||||||
|
import abc
|
||||||
|
import unittest
|
||||||
|
from inspect import isabstract
|
||||||
|
|
||||||
|
def test_abstractmethod_integration(self):
|
||||||
|
for abstractthing in [abc.abstractmethod]:
|
||||||
|
class C(metaclass=abc.ABCMeta):
|
||||||
|
@abstractthing
|
||||||
|
def foo(self): pass # abstract
|
||||||
|
def bar(self): pass # concrete
|
||||||
|
assert C.__abstractmethods__, {"foo"}
|
||||||
|
assert isabstract(C)
|
||||||
|
pass
|
||||||
|
|
||||||
|
test_abstractmethod_integration(None)
|
@@ -1393,9 +1393,15 @@ class SourceWalker(GenericASTTraversal, object):
|
|||||||
def print_super_classes3(self, node):
|
def print_super_classes3(self, node):
|
||||||
n = len(node) - 1
|
n = len(node) - 1
|
||||||
if node.kind != 'expr':
|
if node.kind != 'expr':
|
||||||
assert node[n].kind.startswith('CALL_FUNCTION')
|
if node == 'kwarg':
|
||||||
|
self.write('(')
|
||||||
|
self.template_engine(('%[0]{pattr}=%c', 1), node)
|
||||||
|
self.write(')')
|
||||||
|
return
|
||||||
|
|
||||||
kwargs = None
|
kwargs = None
|
||||||
|
assert node[n].kind.startswith('CALL_FUNCTION')
|
||||||
|
|
||||||
if node[n].kind.startswith('CALL_FUNCTION_KW'):
|
if node[n].kind.startswith('CALL_FUNCTION_KW'):
|
||||||
# 3.6+ starts does this
|
# 3.6+ starts does this
|
||||||
kwargs = node[n-1].attr
|
kwargs = node[n-1].attr
|
||||||
|
Reference in New Issue
Block a user