New submission from kai zhu <[EMAIL PROTECTED]>:

################################
# super_closure.py
class A(object):
  def foo(self):
    return super()
    # remove the closure below
    # & SystemError goes away ???
    lambda: self
A().foo()
################################

when run on 3.0rc1 & 3.0rc2:

hpc-login2 3 ~/work/py3to2: python3.0 super_closure.py
Traceback (most recent call last):
  File "super_closure.py", line 9, in <module>
    A().foo()
  File "super_closure.py", line 5, in foo
    return super()
SystemError: super(): __class__ is not a type (A)

SystemError seems to b raised from typeobject.c (line6155):

static int
super_init(PyObject *self, PyObject *args, PyObject *kwds)
{...
        if (!PyType_Check(type)) {
            PyErr_Format(PyExc_SystemError,
              "super(): __class__ is not a type (%s)",
              Py_TYPE(type)->tp_name);
            return -1;
        }
        break;

----------
components: Build, Interpreter Core
messages: 76093
nosy: kaizhu
severity: normal
status: open
title: SystemError when method has both super() & closure
type: behavior
versions: Python 3.0

_______________________________________
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

Reply via email to