[issue8206] 2to3 doesn't convert 'types.InstanceType' to 'object'
Martin v. Löwis
report at bugs.python.org
Mon Mar 22 23:58:39 CET 2010
Martin v. Löwis <martin at v.loewis.de> added the comment:
I don't think this conversion is correct. If there is a test for InstanceType, there is (IMO) a fifty-fifty-chance that it is there to distinguish old-style and new-style classes, so converting it to object is most likely to break the code.
People who actually want this conversion to happen could replace types.InstanceType with
getattr(types, 'InstanceType', object)
or add
try:
from types import InstanceType
except ImportError:
InstanceType = object
to the top of the module; this would then work for both 2.x and 3.x (assuming that replacing InstanceType with object is actually correct in the code in question).
----------
nosy: +loewis
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8206>
_______________________________________
More information about the Python-bugs-list
mailing list