[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher - mapply.py:1.1.2.7

Jim Fulton jim@zope.com
Sun, 3 Feb 2002 18:45:09 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Publisher
In directory cvs.zope.org:/tmp/cvs-serv11121

Modified Files:
      Tag: Zope-3x-branch
	mapply.py 
Log Message:
Kapil Thangavelu

Added check for infinite loop when looking for callable meta-data.


=== Zope3/lib/python/Zope/Publisher/mapply.py 1.1.2.6 => 1.1.2.7 ===
     wrapperCount = 0
     unwrapped = object
-
-    while 1:
+    
+    for i in range(10):
         if hasattr(unwrapped,'__bases__'):
             # Calling class constructors might be dangerous.
             raise TypeError, "mapply() can not call class constructors"
@@ -38,7 +38,11 @@
             unwrapped = unwrapped.__call__
         else:
             raise TypeError, "mapply() can not call %s" % `object`
-
+    else:
+        raise TypeError(
+            "couldn't find callable metadata, mapply() error on %s"%`object`
+        )
+    
     return unwrapped, wrapperCount
 
 def mapply(object, positional=(), keyword={}, call=apply):