[Zope-Checkins] CVS: Zope/lib/python/Interface - _object.py:1.3
Shane Hathaway
shane@cvs.zope.org
Mon, 10 Jun 2002 16:15:15 -0400
Update of /cvs-repository/Zope/lib/python/Interface
In directory cvs.zope.org:/tmp/cvs-serv17839
Modified Files:
_object.py
Log Message:
Made the Interface package work with the combination of Python 2.2 and
ExtensionClass.
=== Zope/lib/python/Interface/_object.py 1.2 => 1.3 ===
ClassTypes = (type(_x), )
MethodTypes = (type(_x.m), )
-
isInstance = isinstance
+
try:
object
-
except NameError:
# Python 2.1
-
try:
from ExtensionClass import Base as object
except ImportError:
-
- # Python 2.1 wo ExtensionClass
class object: pass
-
- else:
-
- # Python 2.1 w ExtensionClass
-
- def isInstance(ob, klass):
- if type(type(ob)) is type(klass):
- return isinstance(ob, klass)
- return 0
-
- class _x(object):
- def m(self): pass
-
- ClassTypes += (type(_x), )
- MethodTypes += (type(_x.m), )
-
else:
# Python 2.2
ClassTypes += (type, )
object = object
- isinstance = isinstance
+
+try:
+ import ExtensionClass
+except ImportError:
+ # ExtensionClass is not present
+ pass
+else:
+ # ExtensionClass is present
+ def isInstance(ob, klass):
+ if type(type(ob)) is type(klass):
+ return isinstance(ob, klass)
+ return 0
+
+ class _x(ExtensionClass.Base):
+ def m(self): pass
+
+ ClassTypes += (type(_x), )
+ MethodTypes += (type(_x.m), )