• Jeremy Hylton's avatar
    Add checking for a number of metaclass error conditions. · fa955697
    Jeremy Hylton yazdı
    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.
    fa955697
Adı
Son kayıt (commit)
Son güncelleme
Demo Loading commit data...
Doc Loading commit data...
Grammar Loading commit data...
Include Loading commit data...
Lib Loading commit data...
Mac Loading commit data...
Misc Loading commit data...
Modules Loading commit data...
Objects Loading commit data...
PC Loading commit data...
PCbuild Loading commit data...
PCbuild8 Loading commit data...
Parser Loading commit data...
Python Loading commit data...
RISCOS Loading commit data...
Tools Loading commit data...
.hgtags Loading commit data...
LICENSE Loading commit data...
Makefile.pre.in Loading commit data...
README Loading commit data...
configure Loading commit data...
configure.in Loading commit data...
install-sh Loading commit data...
pyconfig.h.in Loading commit data...
setup.py Loading commit data...