cpython/Objects
Jeremy Hylton fa955697fa 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.
2007-02-27 18:29:45 +00:00
..
stringlib Fix endcase for str.rpartition() 2006-09-04 15:32:48 +00:00
abstract.c Silence compiler warning 2007-02-07 23:49:03 +00:00
boolobject.c Remove unnecessary casts in type object initializers. 2006-03-30 11:57:00 +00:00
bufferobject.c memcmp() can return values other than -1, 0, and +1 but tp_compare 2006-08-08 17:37:00 +00:00
cellobject.c Another problem reported by Coverity. Backport candidate. 2006-06-30 07:32:46 +00:00
classobject.c Correctly forward exception in instance_contains(). 2006-11-08 06:46:37 +00:00
cobject.c Remove unnecessary casts in type object initializers. 2006-03-30 11:57:00 +00:00
codeobject.c Fix uninitialized memory read reported by Valgrind when running doctest. 2006-07-12 05:27:46 +00:00
complexobject.c Use sizeof(buffer) instead of duplicating the constants to ensure they won't 2006-07-16 02:22:30 +00:00
descrobject.c Change fix for segfaulting property(), add a NEWS entry and a test. 2006-08-04 18:03:37 +00:00
dictnotes.txt Patch #1397848: add the reasoning behind no-resize-on-shrinkage. 2007-02-15 09:51:35 +00:00
dictobject.c Variation of patch # 1624059 to speed up checking if an object is a subclass 2007-02-25 19:44:48 +00:00
enumobject.c Do not let overflows in enumerate() and count() pass silently. 2007-02-08 00:07:32 +00:00
exceptions.c Variation of patch # 1624059 to speed up checking if an object is a subclass 2007-02-25 19:44:48 +00:00
fileobject.c SF patch #1630975: Fix crash when replacing sys.stdout in sitecustomize 2007-01-23 13:42:00 +00:00
floatobject.c Reverting the patch that tried to fix the issue whereby x**2 raises 2006-08-23 22:17:59 +00:00
frameobject.c tabify 2007-02-27 16:00:06 +00:00
funcobject.c Whoops, how did that get in there. :-) Revert all the parts of 51227 that were not supposed to go it. Only Modules/_ctypes/cfields.c was supposed to be changed 2006-08-12 02:12:30 +00:00
genobject.c Make use of METH_O and METH_NOARGS where possible. 2006-05-29 21:04:52 +00:00
intobject.c Variation of patch # 1624059 to speed up checking if an object is a subclass 2007-02-25 19:44:48 +00:00
iterobject.c Use Py_VISIT in all tp_traverse methods, instead of traversing manually or 2006-04-15 21:47:09 +00:00
listobject.c Variation of patch # 1624059 to speed up checking if an object is a subclass 2007-02-25 19:44:48 +00:00
listsort.txt typo fix 2006-08-01 16:24:30 +00:00
longobject.c Variation of patch # 1624059 to speed up checking if an object is a subclass 2007-02-25 19:44:48 +00:00
methodobject.c Use Py_VISIT in all tp_traverse methods, instead of traversing manually or 2006-04-15 21:47:09 +00:00
moduleobject.c Use Py_VISIT in all tp_traverse methods, instead of traversing manually or 2006-04-15 21:47:09 +00:00
object.c Slightly revised version of patch #1538956: 2006-08-14 10:55:19 +00:00
obmalloc.c Don't inline Py_ADDRESS_IN_RANGE with gcc 4+ either. 2006-10-28 21:21:00 +00:00
rangeobject.c Remove "static forward" declaration. Move constructors 2006-04-11 09:04:12 +00:00
setobject.c Fixup set/dict interoperability. 2007-02-19 20:44:04 +00:00
sliceobject.c Patch #1538606, Patch to fix __index__() clipping. 2006-08-12 17:03:09 +00:00
stringobject.c Backport from Py3k branch: fix refleak in PyString_Format. 2007-02-26 13:51:29 +00:00
structseq.c Klocwork made another run and found a bunch more problems. 2006-08-12 01:43:40 +00:00
tupleobject.c Variation of patch # 1624059 to speed up checking if an object is a subclass 2007-02-25 19:44:48 +00:00
typeobject.c Add checking for a number of metaclass error conditions. 2007-02-27 18:29:45 +00:00
unicodectype.c Patch 1494554: Update numeric properties to Unicode 4.1. 2006-05-27 08:36:52 +00:00
unicodeobject.c Variation of patch # 1624059 to speed up checking if an object is a subclass 2007-02-25 19:44:48 +00:00
unicodetype_db.h Update Unicode database to Unicode 4.1. 2006-03-09 23:38:20 +00:00
weakrefobject.c Fix crasher for when an object's __del__ creates a new weakref to itself. 2007-01-23 23:21:22 +00:00