diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2007-02-27 18:29:45 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2007-02-27 18:29:45 (GMT) |
commit | fa955697fa0986b19abac7b026c8f00b4393adf9 (patch) | |
tree | 33731c5bb7b7e6fee121763b7c29439f1cc97779 /Lib/plat-irix6/readcd.py | |
parent | 2d1f5c93bbe3ed6202e14e9d3c3708174b62f8e6 (diff) | |
download | cpython-fa955697fa0986b19abac7b026c8f00b4393adf9.zip cpython-fa955697fa0986b19abac7b026c8f00b4393adf9.tar.gz cpython-fa955697fa0986b19abac7b026c8f00b4393adf9.tar.bz2 |
Add checking for a number of metaclass error conditions.
We add some new rules that are required for preserving internal
invariants of types.
1. If type (or a subclass of type) appears in bases, it must appear
before any non-type bases. If a non-type base (like a regular
new-style class) occurred first, it could trick type into
allocating the new class an __dict__ which must be impossible.
2. There are several checks that are made of bases when creating a
type. Those checks are now repeated when assigning to __bases__.
We also add the restriction that assignment to __bases__ may not
change the metaclass of the type.
Add new tests for these cases and for a few other oddball errors that
were no previously tested. Remove a crasher test that was fixed.
Also some internal refactoring: Extract the code to find the most
derived metaclass of a type and its bases. It is now needed in two
places. Rewrite the TypeError checks in test_descr to use doctest.
The tests now clearly show what exception they expect to see.
Diffstat (limited to 'Lib/plat-irix6/readcd.py')
0 files changed, 0 insertions, 0 deletions