[Zope3-checkins] SVN: Zope3/trunk/src/zope/interface/declarations.py workaround for issue in 2.2.0

Itamar Shtull-Trauring zope at itamarst.org
Sat Aug 14 14:09:33 EDT 2004


Log message for revision 27136:
  workaround for issue in 2.2.0
  


Changed:
  U   Zope3/trunk/src/zope/interface/declarations.py


-=-
Modified: Zope3/trunk/src/zope/interface/declarations.py
===================================================================
--- Zope3/trunk/src/zope/interface/declarations.py	2004-08-13 21:50:21 UTC (rev 27135)
+++ Zope3/trunk/src/zope/interface/declarations.py	2004-08-14 18:09:33 UTC (rev 27136)
@@ -554,8 +554,11 @@
     frame = sys._getframe(2)
     locals = frame.f_locals
 
-    # Try to make sure we were called from a class def
-    if (locals is frame.f_globals) or ('__module__' not in locals):
+    # Try to make sure we were called from a class def. In 2.2.0 we can't
+    # check for __module__ since it doesn't seem to be added to the locals
+    # until later on.
+    if (locals is frame.f_globals) or (
+        ('__module__' not in locals) and sys.version_info[:3] > (2, 2, 0)):
         raise TypeError(name+" can be used only from a class definition.")
 
     if '__implements_advice_data__' in locals:



More information about the Zope3-Checkins mailing list