[ python-Bugs-1263635 ] type() and isinstance() do not call __getattribute__
SourceForge.net
noreply at sourceforge.net
Fri Aug 19 04:07:29 CEST 2005
Bugs item #1263635, was opened at 2005-08-19 04:07
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1263635&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Per Vognsen (pervognsen)
Assigned to: Nobody/Anonymous (nobody)
Summary: type() and isinstance() do not call __getattribute__
Initial Comment:
The built-in functions type() and isinstance() do not call
__getattribute__ for instances of user-defined classes.
Thus, for instance,
x.__class__ == sometype
and
type(x) == sometype
can give inconsistent results.
I ran into this problem in writing a transparent
persistence system, where instances of proxy classes
are used as stand-ins for unloaded objects and the
proxy does just-in-time loading by overloading
__getattribute__ and __setattr__ (which changes
__class__).
(This applies to 2.4.1.)
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1263635&group_id=5470
More information about the Python-bugs-list
mailing list