From 6d609b77bed791cab4af92360bf5042fac1e4ff7 Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Fri, 14 Mar 2014 11:22:58 -0700 Subject: [PATCH] BUG: Use getfullargspec() on Python 3 --- numpydoc/docscrape.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/numpydoc/docscrape.py b/numpydoc/docscrape.py index 2c49ed84..2b1719db 100644 --- a/numpydoc/docscrape.py +++ b/numpydoc/docscrape.py @@ -9,6 +9,7 @@ import pydoc from warnings import warn import collections +import sys class Reader(object): @@ -433,7 +434,10 @@ def __init__(self, func, role='func', doc=None, config={}): func, func_name = self.get_func() try: # try to read signature - argspec = inspect.getargspec(func) + if sys.version_info[0] >= 3: + argspec = inspect.getfullargspec(func) + else: + argspec = inspect.getargspec(func) argspec = inspect.formatargspec(*argspec) argspec = argspec.replace('*','\*') signature = '%s%s' % (func_name, argspec)