[Python-Dev] [Python-checkins] r53997 - in python/trunk: Lib/test/crashers/modify_dict_attr.py Lib/test/test_descr.py Objects/typeobject.c

Armin Rigo arigo at tunes.org
Fri Mar 9 21:45:17 CET 2007


Hi Jeremy,

On Tue, Feb 27, 2007 at 07:29:50PM +0100, jeremy.hylton wrote:
> Removed:
>    python/trunk/Lib/test/crashers/modify_dict_attr.py
> Modified:
>    python/trunk/Lib/test/test_descr.py
>    python/trunk/Objects/typeobject.c
> Log:
> Add checking for a number of metaclass error conditions.

This check-in looks highly suspicious to me.  It doesn't solve the
problem it set out to solve, which is the modify_dict_attr crasher - see
the slightly modified modify_dict_attr that I re-checked in
(Lib/test/crashers/).  Instead it adds more of the obscure undocumented
rules about what kind of inheritence is allowed or not.  We already have
cases like:

    class X(str): pass
    class Y(str): pass
    class Z(X, Y): pass
   
which are forbidden for no user-discernable reason.  I don't think that
forbidding:

    class X(Y, type): pass

is going to help clarity there.

The problem with modify_dict_attr is at a different level; if needed I
can elaborate on the following comment from the SF tracker:

    """A proposed fix [for modify_dict_attr]: the __dict__ descriptor of
    user-defined classes should verify if there is another __dict__
    descriptor along the solid path of the type (i.e. following "tp_base"
    pointers).  If so, it should delegate to it."""


A bientot,

Armin.


More information about the Python-Dev mailing list