diff options
| author | mitsuhiko <devnull@localhost> | 2009-02-01 20:51:16 +0100 |
|---|---|---|
| committer | mitsuhiko <devnull@localhost> | 2009-02-01 20:51:16 +0100 |
| commit | afbab8de96e7771f8d5d1fde8f3ba9909b649372 (patch) | |
| tree | 5fee5e4093da976c189611f8acb4c1b8be6eea45 /sphinx/ext | |
| parent | cca9de484189cbf76b47a18831993a9bc077bbf1 (diff) | |
| parent | 25bcacb4a61db2f265bf8bf38db1cd7cb0ff5abe (diff) | |
| download | sphinx-afbab8de96e7771f8d5d1fde8f3ba9909b649372.tar.gz | |
Merge
Diffstat (limited to 'sphinx/ext')
| -rw-r--r-- | sphinx/ext/autodoc.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index 3ca92e86..a817e343 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -324,7 +324,18 @@ class RstGenerator(object): # can never get arguments of a C function or method getargs = False if getargs: - argspec = inspect.getargspec(obj) + try: + argspec = inspect.getargspec(obj) + except TypeError: + # if a class should be documented as function (yay duck + # typing) we try to use the constructor signature as function + # signature without the first argument. + try: + argspec = inspect.getargspec(obj.__new__) + except TypeError: + argspec = inspect.getargspec(obj.__init__) + if argspec[0]: + del argspec[0][0] if what in ('class', 'method', 'staticmethod', 'classmethod') and argspec[0] and \ argspec[0][0] in ('cls', 'self'): |
