[Python-checkins] r65444 - python/trunk/Lib/SimpleXMLRPCServer.py

brett.cannon python-checkins at python.org
Mon Aug 4 00:57:24 CEST 2008


Author: brett.cannon
Date: Mon Aug  4 00:57:23 2008
New Revision: 65444

Log:
Remove a dict.has_key() and callable() usage in SimpleXMLRPCServer as triggered
under -3 through test_xmlrpc.


Modified:
   python/trunk/Lib/SimpleXMLRPCServer.py

Modified: python/trunk/Lib/SimpleXMLRPCServer.py
==============================================================================
--- python/trunk/Lib/SimpleXMLRPCServer.py	(original)
+++ python/trunk/Lib/SimpleXMLRPCServer.py	Mon Aug  4 00:57:23 2008
@@ -141,7 +141,7 @@
 
     return [member for member in dir(obj)
                 if not member.startswith('_') and
-                    callable(getattr(obj, member))]
+                    hasattr(getattr(obj, member), '__call__')]
 
 def remove_duplicates(lst):
     """remove_duplicates([2,2,2,1,3,3]) => [3,1,2]
@@ -315,7 +315,7 @@
         Returns a string containing documentation for the specified method."""
 
         method = None
-        if self.funcs.has_key(method_name):
+        if method_name in self.funcs:
             method = self.funcs[method_name]
         elif self.instance is not None:
             # Instance can implement _methodHelp to return help for a method


More information about the Python-checkins mailing list