[Python-bugs-list] [ python-Bugs-487390 ] Modifying type.__module__ behavior
noreply@sourceforge.net
noreply@sourceforge.net
Tue, 04 Dec 2001 08:41:50 -0800
Bugs item #487390, was opened at 2001-11-29 21:10
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=487390&group_id=5470
>Category: Type/class unification
>Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Burton Radons (loth)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: Modifying type.__module__ behavior
Initial Comment:
A __module__ attribute request on a C type will return
__builtin__ if the typeobject.c code cannot find a
period in the type name. This is always incorrect for
extension libraries, and can be a _very_ confusing
error when trying to pickle your types (as the error
makes it seem as if you're supposed to register your
type in __builtin__). I propose that:
A) All builtin Python types have a "__builtin__."
prefixed to their type declaration's name.
B) If the __module__ code cannot find a period, it
raises AttributeError with a somewhat descriptive
message. This would be in the place where it returns
__builtin__.
C) The tp_name comment in Include/object.h describe the
special semantics. "/* 'module.typename' */", for example.
This is a lot of files to change, I know, but it's only
one or two line changes each file. The only code this
should affect is code which is written incorrectly; it
may not understand the name semantics, or it may
actually be registering itself in __builtin__ (as I did
before I figured out what it was doing). Otherwise
we're golden.
----------------------------------------------------------------------
>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-04 08:41
Message:
Logged In: YES
user_id=6380
I agree with this in principle, but I don't hve the time to
make all the changes. Can you submit a patch? Since, as
you say, it's so simple, I wouldn't object against including
it in 2.2c1, if it's submitted in time (2.2c1 is planned for
December 12 -- give us a couple of days before that).
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=487390&group_id=5470