mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
(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.
This commit is contained in:
parent
7ec1c85d7a
commit
e54616cb6f
2 changed files with 13 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue