[PATCH 4 of 8] extensions: restore use of callable() since it was readded in Python 3.2

Augie Fackler raf at durin42.com
Tue Jun 24 13:37:40 CDT 2014


# HG changeset patch
# User Augie Fackler <raf at durin42.com>
# Date 1403529846 14400
#      Mon Jun 23 09:24:06 2014 -0400
# Node ID 8bc64249b278b7565675f2922de6f33a218a1936
# Parent  973a41fae77f5056dc4e5fab0c07227b5d1c8b7e
extensions: restore use of callable() since it was readded in Python 3.2

diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -138,7 +138,7 @@
     where orig is the original (wrapped) function, and *args, **kwargs
     are the arguments passed to it.
     '''
-    assert util.safehasattr(wrapper, '__call__')
+    assert callable(wrapper)
     aliases, entry = cmdutil.findcmd(command, table)
     for alias, e in table.iteritems():
         if e is entry:
@@ -191,12 +191,12 @@
     your end users, you should play nicely with others by using the
     subclass trick.
     '''
-    assert util.safehasattr(wrapper, '__call__')
+    assert callable(wrapper)
     def wrap(*args, **kwargs):
         return wrapper(origfn, *args, **kwargs)
 
     origfn = getattr(container, funcname)
-    assert util.safehasattr(origfn, '__call__')
+    assert callable(origfn)
     setattr(container, funcname, wrap)
     return origfn
 


More information about the Mercurial-devel mailing list