Python 3.x class bug using subclass fns

This commit is contained in:
rocky
2016-06-20 17:14:46 -04:00
parent 80cfe62f36
commit 59780483a8
5 changed files with 16 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,7 @@
# From 3.4 ctypes/__init__.py
# For opcode LOAD_CLASSDEREF
def CFUNCTYPE(argtypes):
class CFunctionType(object):
_argtypes_ = argtypes
return CFunctionType

View File

@@ -0,0 +1,5 @@
# From python 3.4 endian.py
# Bug was having two CALL_FUNCTION ops in bytecode.
from ctypes import *
class _swapped_meta(type(Structure)):
pass

View File

@@ -400,9 +400,11 @@ class Python3Parser(PythonParser):
call_function))
self.add_unique_rule(rule, opname, token.attr, customize)
# Can the above build_class rule be folded into this rule?
# FIXME: What's the deal with the two rules? Different Python versions?
# Different situations? Note that the above rule is based on the CALL_FUNCTION
# token found, while this one doesn't.
rule = ("build_class ::= LOAD_BUILD_CLASS mkfunc expr call_function "
"CALL_FUNCTION_" + str(args_pos+1))
"CALL_FUNCTION_3")
self.add_unique_rule(rule, opname, token.attr, customize)
return