[Python-bugs-list] [ python-Bugs-492345 ] New-style class with only classic bases

noreply@sourceforge.net noreply@sourceforge.net
Wed, 12 Dec 2001 20:59:40 -0800


Bugs item #492345, was opened at 2001-12-12 20:26
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=492345&group_id=5470

>Category: Type/class unification
>Group: Python 2.2
>Status: Closed
>Resolution: Fixed
Priority: 7
Submitted By: Guido van Rossum (gvanrossum)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: New-style class with only classic bases

Initial Comment:
I just tried this:

>>> class A: pass
... 
>>> class B: pass
... 
>>> class C(A, B): __metaclass__ = type
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
SystemError: NULL result without error in PyObject_Call
>>> 


----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-12 20:59

Message:
Logged In: YES 
user_id=6380

Oops, that was easier than I feared. best_bases() returned
NULL without an error; there was an assert though in debug
mode that helped me find it quickly. I've decided for now to
declare this an error -- if you have a new-style metaclass,
you must have at least one new-style base class. (I first
tried to fix it, but after making the class statement pass,
the constructed class couldn't be instantiated and didn't
have 'object' in its __mro__, so I gave up quickly.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=492345&group_id=5470