[Zope3-checkins] SVN: Zope3/trunk/ Fixed issue 228

Dmitry Vasiliev dima at hlabs.spb.ru
Wed Aug 4 05:38:12 EDT 2004


Log message for revision 26898:
  Fixed issue 228
  


Changed:
  U   Zope3/trunk/doc/CHANGES.txt
  U   Zope3/trunk/src/zope/interface/_zope_interface_coptimizations.c
  UU  Zope3/trunk/src/zope/interface/tests/test_interface.py
  _U  Zope3/trunk/src/zope/interface/tests/unitfixtures.py


-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt	2004-08-04 07:10:32 UTC (rev 26897)
+++ Zope3/trunk/doc/CHANGES.txt	2004-08-04 09:38:12 UTC (rev 26898)
@@ -61,6 +61,8 @@
 
     Bug Fixes
 
+      - Fixed issue 228.
+
       - Fixed issue 248.  Path expressions in page templates that
         contain empty segments now cause an error to be raised when
         the expression is compiled rather than when it is evaluated.

Modified: Zope3/trunk/src/zope/interface/_zope_interface_coptimizations.c
===================================================================
--- Zope3/trunk/src/zope/interface/_zope_interface_coptimizations.c	2004-08-04 07:10:32 UTC (rev 26897)
+++ Zope3/trunk/src/zope/interface/_zope_interface_coptimizations.c	2004-08-04 09:38:12 UTC (rev 26898)
@@ -178,7 +178,7 @@
       return getObjectSpecification(NULL, ob);
     } 
 
-  
+
   /* We want to make sure we have a spec. We can't do a type check
      because we may have a proxy, so we'll just try to get the
      only attribute.
@@ -256,7 +256,7 @@
 
   implied = inst_attr(self, str_implied);
   if (implied == NULL)
-    return implied;
+    return NULL;
 
 #ifdef Py_True
   if (PyDict_GetItem(implied, other) != NULL)
@@ -285,7 +285,9 @@
   PyObject *decl, *item;
 
   decl = providedBy(NULL, ob);
-  
+  if (decl == NULL)
+    return NULL;
+
   if (PyObject_TypeCheck(ob, &SpecType))
     item = Spec_extends(decl, self);
   else

Modified: Zope3/trunk/src/zope/interface/tests/test_interface.py
===================================================================
--- Zope3/trunk/src/zope/interface/tests/test_interface.py	2004-08-04 07:10:32 UTC (rev 26897)
+++ Zope3/trunk/src/zope/interface/tests/test_interface.py	2004-08-04 09:38:12 UTC (rev 26898)
@@ -24,12 +24,6 @@
 
 class InterfaceTests(unittest.TestCase):
 
-    def setUp(self):
-        pass
-
-    def tearDown(self):
-        pass
-
     def testClassImplements(self):
         self.assert_(IC.implementedBy(C))
 
@@ -251,6 +245,14 @@
         self.assertEqual(I.__doc__, "")
         self.assertEqual(list(I), ['__doc__'])
 
+    def testIssue228(self):
+        # Test for http://collector.zope.org/Zope3-dev/228
+        class I(Interface):
+            "xxx"
+        class Bad:
+            __providedBy__ = None
+        # Old style classes don't have a '__class__' attribute
+        self.failUnlessRaises(AttributeError, I.providedBy, Bad)
 
 
 class _I1(Interface):


Property changes on: Zope3/trunk/src/zope/interface/tests/test_interface.py
___________________________________________________________________
Name: svn:keywords
   + Id


Property changes on: Zope3/trunk/src/zope/interface/tests/unitfixtures.py
___________________________________________________________________
Name: svn:keywords
   + Id



More information about the Zope3-Checkins mailing list