summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2013-01-13 09:31:41 -0500
committerBenjamin Peterson <benjamin@python.org>2013-01-13 09:31:41 -0500
commit91d80756e350a002cdfdba2254d4f35a806e7b65 (patch)
treefad3c4decc2bc72c7ea1867d95e226d646a0a401
parent64fdc268911058cf7408bf1534ca498b0b9b8b3b (diff)
downloadsix-91d80756e350a002cdfdba2254d4f35a806e7b65.tar.gz
define callable to builtin callable when it's available on the latest py3 versions (fixes #17)
-rw-r--r--CHANGES3
-rw-r--r--six.py10
2 files changed, 10 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index 314a87e..86f621c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,9 @@ This file lists the changes in each six version.
Development version
-------------------
+- Issue #17: Define callable to be builtin callable when it is available again
+ in Python 3.2+.
+
- Issue #16: Rename Python 2 exec_'s arguments, so casually calling exec_ with
keyword arguments will raise.
diff --git a/six.py b/six.py
index 4fc0d2c..ab45e38 100644
--- a/six.py
+++ b/six.py
@@ -235,14 +235,18 @@ except NameError:
next = advance_iterator
+try:
+ callable = callable
+except NameError:
+ def callable(obj):
+ return any("__call__" in klass.__dict__ for klass in type(obj).__mro__)
+
+
if PY3:
def get_unbound_function(unbound):
return unbound
Iterator = object
-
- def callable(obj):
- return any("__call__" in klass.__dict__ for klass in type(obj).__mro__)
else:
def get_unbound_function(unbound):
return unbound.im_func