diff options
author | Guido van Rossum <guido@python.org> | 2001-12-14 04:19:56 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-12-14 04:19:56 (GMT) |
commit | e54616cb6fdd9f9fb0d86ddd2cd5c4ffb51771b8 (patch) | |
tree | c8bab15509c8f6436c7fb03af0d9cbfd88902bef /Objects | |
parent | 7ec1c85d7a87e1aff699421d741be8dfca2adee9 (diff) | |
download | cpython-e54616cb6fdd9f9fb0d86ddd2cd5c4ffb51771b8.zip cpython-e54616cb6fdd9f9fb0d86ddd2cd5c4ffb51771b8.tar.gz cpython-e54616cb6fdd9f9fb0d86ddd2cd5c4ffb51771b8.tar.bz2 |
(Merge into trunk.)
Fix for SF bug #492345. (I could've sworn I checked this in, but
apparently I didn't!)
This code:
class Classic:
pass
class New(Classic):
__metaclass__ = type
attempts to create a new-style class with only classic bases -- but it
doesn't work right. Attempts to fix it so it works caused problems
elsewhere, so I'm now raising a TypeError in this case.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 6243e81..ba30063 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -757,7 +757,9 @@ best_base(PyObject *bases) return NULL; } } - assert(base != NULL); + if (base == NULL) + PyErr_SetString(PyExc_TypeError, + "a new-style class can't have only classic bases"); return base; } |