[ python-Bugs-1026269 ] Confusing error message when subclassing from invalid base

SourceForge.net noreply at sourceforge.net
Sat Sep 11 12:13:34 CEST 2004


Bugs item #1026269, was opened at 2004-09-11 12:13
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1026269&group_id=5470

Category: Python Interpreter Core
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Gerrit Holl (gerrit)
Assigned to: Nobody/Anonymous (nobody)
Summary: Confusing error message when subclassing from invalid base

Initial Comment:
In Python 2.3, subclassing from bool resulted in:

>>> class Test(bool): pass
...
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: type 'bool' is not an acceptable base type

In Python2.4a3 (latest CVS), it results in:

>>> class Test(bool): pass
...
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: Error when calling the metaclass.
Make sure the base arguments are valid.

Interestingly, also in Python 2.4a3:

>>> type("foo", (bool,), {})
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: type 'bool' is not an acceptable base type

I think it is a bug, and the error message should be
'not an acceptable base type'. Apart from that, I don't
see why it is not an acceptable base type, but that's a
different issue.

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

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


More information about the Python-bugs-list mailing list