From 947a4fdc9075aa55a8b2d518bd8d1513c3156d40 2014-08-26 20:54:17 From: Erik M. Bray Date: 2014-08-26 20:54:17 Subject: [PATCH] Use the more powerful signatures module to display function argument signatures. In particular this works better for functions wrapped with functools.wraps (at least on Python >= 3.4) --- diff --git a/IPython/core/oinspect.py b/IPython/core/oinspect.py index 68adadb..6e6b31b 100644 --- a/IPython/core/oinspect.py +++ b/IPython/core/oinspect.py @@ -40,6 +40,7 @@ from IPython.utils.text import indent from IPython.utils.wildcard import list_namespace from IPython.utils.coloransi import TermColors, ColorScheme, ColorSchemeTable from IPython.utils.py3compat import cast_unicode, string_types, PY3 +from IPython.utils.signatures import signature # builtin docstrings to ignore _func_call_docstring = types.FunctionType.__call__.__doc__ @@ -390,7 +391,7 @@ class Inspector: If any exception is generated, None is returned instead and the exception is suppressed.""" try: - hdef = oname + inspect.formatargspec(*getargspec(obj)) + hdef = oname + str(signature(obj)) return cast_unicode(hdef) except: return None