[Python-bugs-list] [ python-Bugs-563730 ] isinstance() fails to identify obj class

noreply@sourceforge.net noreply@sourceforge.net
Sun, 02 Jun 2002 21:00:13 -0700


Bugs item #563730, was opened at 2002-06-03 14:00
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=563730&group_id=5470

Category: None
Group: Python 2.2.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Jessica Preston (jesspreston)
Assigned to: Nobody/Anonymous (nobody)
Summary: isinstance() fails to identify obj class

Initial Comment:
The problem seems to be that if I create two objects
using the same class
constructor, but having imported the class differently,
the isinstance() method
fails to identify them as being the same. The problem
only occurs (I think)
when cPickle is used, at least, that was how I managed
to reproduce it.

I have attached an example which includes a README and
a couple of directories:

SampleDir contains
- Simple.py (a simple class that has a compare() method
that uses isinstance)
- Main.py

SampleDir/NestedDir contains
- CreatePickle.py (which creates a Simple() object and
pickles it into the cwd)

Main.py unpickles the Simple object created by
CreatePickle.py, then compares it against a newly
created Simple() object using the Simple.compare()
method. It should raise as Assertion error claiming
that the passed object was not a Simple object.
However, it is.

I looked through existing bug reports and found a very
similar one from 2001 with tracking number 467267 -
this was marked as invalid, I think, but I'm not sure
whether this resolves my problem.

The README contains instructions on running the
example, plus my system information.

I am running RedHat7.1, with kernel 2.4.18 (if
relevant) and
the version of python I am using is Python 2.2.1

I hope that this will demonstrate the problem.

Thanks
-jess

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=563730&group_id=5470