Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

pprinting old-style class objects fails (TypeError: 'tuple' object is not callable) #1074

Closed
kcarnold opened this Issue · 1 comment

2 participants

@kcarnold
In [1]: class A: pass
In [2]: A
...
/Users/kcarnold/.virtualenvs/py27/lib/python2.7/site-packages/IPython/lib/pretty.pyc in pretty(self, obj)
    341             for cls in _get_mro(obj_class):
    342                 if cls in self.type_pprinters:
--> 343                     return self.type_pprinters[cls](obj, self, cycle)
    344                 else:
    345                     printer = self._in_deferred_types(cls)

TypeError: 'tuple' object is not callable

Unfortunately some classes in the Python standard library are old-style, so I stumbled across this one.

The fix is trivial and hardly worth a pull request:

diff --git a/IPython/lib/pretty.py b/IPython/lib/pretty.py
index 4361f21..f6f109c 100644
--- a/IPython/lib/pretty.py
+++ b/IPython/lib/pretty.py
@@ -668,7 +668,7 @@ _type_pprinters = {

 try:
     _type_pprinters[types.DictProxyType] = _dict_pprinter_factory('<dictproxy {', '}>')
-    _type_pprinters[types.ClassType] = _type_pprint,
+    _type_pprinters[types.ClassType] = _type_pprint
 except AttributeError: # Python 3
     pass
@minrk minrk closed this in 13c8185
@minrk
Owner

thanks, fix pushed.

@ellisonbg ellisonbg referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@mattvonrocketstein mattvonrocketstein referenced this issue from a commit in mattvonrocketstein/ipython
@minrk minrk remove erroneous trailing comma in lib.pretty
c/o @kcarnold
closes #1074
44c388a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.