diff options
author | Larry Hastings <larry@hastings.org> | 2014-01-24 14:17:25 (GMT) |
---|---|---|
committer | Larry Hastings <larry@hastings.org> | 2014-01-24 14:17:25 (GMT) |
commit | 5c66189e88034ba807b10422a8750b0c71c4b62b (patch) | |
tree | 541626d6d627396acaccab565e936d35c3b99173 /Lib/pydoc.py | |
parent | b3c0f4067d992fc2c0d8578e308cc7167dc98f32 (diff) | |
download | cpython-5c66189e88034ba807b10422a8750b0c71c4b62b.zip cpython-5c66189e88034ba807b10422a8750b0c71c4b62b.tar.gz cpython-5c66189e88034ba807b10422a8750b0c71c4b62b.tar.bz2 |
Issue #20189: Four additional builtin types (PyTypeObject,
PyMethodDescr_Type, _PyMethodWrapper_Type, and PyWrapperDescr_Type)
have been modified to provide introspection information for builtins.
Also: many additional Lib, test suite, and Argument Clinic fixes.
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-x | Lib/pydoc.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 9f62692..cf164cc 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -925,7 +925,10 @@ class HTMLDoc(Doc): anchor, name, reallink) argspec = None if inspect.isfunction(object) or inspect.isbuiltin(object): - signature = inspect.signature(object) + try: + signature = inspect.signature(object) + except (ValueError, TypeError): + signature = None if signature: argspec = str(signature) if realname == '<lambda>': @@ -1319,8 +1322,12 @@ location listed above. skipdocs = 1 title = self.bold(name) + ' = ' + realname argspec = None - if inspect.isfunction(object) or inspect.isbuiltin(object): - signature = inspect.signature(object) + + if inspect.isroutine(object): + try: + signature = inspect.signature(object) + except (ValueError, TypeError): + signature = None if signature: argspec = str(signature) if realname == '<lambda>': |