kai zhu <[EMAIL PROTECTED]> added the comment: oops, sorry reprinted the same code ^^;;; ignore previous post, & use this: (sorry again for mucking up this page)
################################ # super_ok.py class A(object): def foo(self): return super() # comment the closure below # & SystemError goes away # lambda: self A().foo() ################################ >>> s = open("super_ok.py").read(); c = compile(s, "super_ok.py", "exec"); t = py3to2.codetree(c) >>> print( t ) codetree( co_argcount = 0, co_cellvars = (), co_code = b'Gd\x00\x00\x84\x00\x00d\x01\x00e\x00\x00\x83\x03\x00Z\x01\x00e\x01\x00\x83\x00\x00j\x02\x00\x83\x00\x00\x01d\x02\x00S', co_filename = 'super_ok.py', co_firstlineno = 3, co_flags = 64, co_freevars = (), co_kwonlyargcount =0, co_lnotab = b'\x13\x06', co_name = '<module>', co_names = ('object', 'A', 'foo'), co_nlocals = 0, co_stacksize = 4, co_varnames = (), depth = 0, co_consts = ( codetree( co_argcount = 1, co_cellvars = ('__class__',), co_code = b'|\x00\x00Ee\x00\x00Z\x01\x00\x87\x00\x00f\x01\x00d\x00\x00\x86\x00\x00Z\x02\x00\x87\x00\x00S', co_filename = 'super_ok.py', co_firstlineno = 3, co_flags = 2, co_freevars = (), co_kwonlyargcount =0, co_lnotab = b'\n\x01', co_name = 'A', co_names = ('__name__', '__module__', 'foo'), co_nlocals = 1, co_stacksize = 2, co_varnames = ('__locals__',), depth = 1, co_consts = ( codetree( co_argcount = 1, co_cellvars = (), co_code = b't\x00\x00\x83\x00\x00S', co_filename = 'super_ok.py', co_firstlineno = 4, co_flags = 3, co_freevars = ('__class__',), co_kwonlyargcount =0, co_lnotab = b'\x00\x01', co_name = 'foo', co_names = ('super',), co_nlocals = 1, co_stacksize = 1, co_varnames = ('self',), depth = 2, co_consts = ( None, )), )), A, None, )) >>> print( t.dis() ) 3 0 LOAD_BUILD_CLASS 1 LOAD_CONST 0 (<code object A at 0x2a987afd30, file "super_ok.py", line 3>) 4 MAKE_FUNCTION 0 7 LOAD_CONST 1 ('A') 10 LOAD_NAME 0 (object) 13 CALL_FUNCTION 3 16 STORE_NAME 1 (A) 9 19 LOAD_NAME 1 (A) 22 CALL_FUNCTION 0 25 LOAD_ATTR 2 (foo) 28 CALL_FUNCTION 0 31 POP_TOP 32 LOAD_CONST 2 (None) 35 RETURN_VALUE 3 0 LOAD_FAST 0 (__locals__) 3 STORE_LOCALS 4 LOAD_NAME 0 (__name__) 7 STORE_NAME 1 (__module__) 4 10 LOAD_CLOSURE 0 (__class__) 13 BUILD_TUPLE 1 16 LOAD_CONST 0 (<code object foo at 0x2a984c0530, file "super_ok.py", line 4>) 19 MAKE_CLOSURE 0 22 STORE_NAME 2 (foo) 25 LOAD_CLOSURE 0 (__class__) 28 RETURN_VALUE 5 0 LOAD_GLOBAL 0 (super) 3 CALL_FUNCTION 0 6 RETURN_VALUE >>> _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4360> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com