Issue 32352: inspect.getfullargspec doesn't work fine for some builtin callable objects (original) (raw)

Issue32352

Created on 2017-12-17 13:47 by thautwarm, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg308488 - (view) Author: thautwarm (thautwarm) * Date: 2017-12-17 13:47
It's quite confusing to me that `inspect.getfullargspec` crashed when it was applied on some builtin callable objects. ``` for each in __builtin__.__dict__: try: obj = getattr(__builtin__, each) if not callable(obj): continue inspect.getfullargspec(obj) except Exception as e: print(each, e) ``` Here are the results: ``` __build_class__ unsupported callable __import__ unsupported callable dir unsupported callable getattr unsupported callable iter unsupported callable max unsupported callable min unsupported callable next unsupported callable print unsupported callable round unsupported callable vars unsupported callable bool unsupported callable bytearray unsupported callable bytes unsupported callable classmethod unsupported callable complex unsupported callable dict unsupported callable enumerate unsupported callable filter unsupported callable float unsupported callable frozenset unsupported callable property unsupported callable int unsupported callable list unsupported callable map unsupported callable range unsupported callable reversed unsupported callable set unsupported callable slice unsupported callable staticmethod unsupported callable str unsupported callable super unsupported callable tuple unsupported callable type unsupported callable zip unsupported callable BaseException unsupported callable Exception unsupported callable TypeError unsupported callable StopAsyncIteration unsupported callable StopIteration unsupported callable GeneratorExit unsupported callable SystemExit unsupported callable KeyboardInterrupt unsupported callable ImportError unsupported callable ModuleNotFoundError unsupported callable OSError unsupported callable EnvironmentError unsupported callable IOError unsupported callable WindowsError unsupported callable EOFError unsupported callable RuntimeError unsupported callable RecursionError unsupported callable NotImplementedError unsupported callable NameError unsupported callable UnboundLocalError unsupported callable AttributeError unsupported callable SyntaxError unsupported callable IndentationError unsupported callable TabError unsupported callable LookupError unsupported callable IndexError unsupported callable KeyError unsupported callable ValueError unsupported callable UnicodeError unsupported callable UnicodeEncodeError unsupported callable UnicodeDecodeError unsupported callable UnicodeTranslateError unsupported callable AssertionError unsupported callable ArithmeticError unsupported callable FloatingPointError unsupported callable OverflowError unsupported callable ZeroDivisionError unsupported callable SystemError unsupported callable ReferenceError unsupported callable BufferError unsupported callable MemoryError unsupported callable Warning unsupported callable UserWarning unsupported callable DeprecationWarning unsupported callable PendingDeprecationWarning unsupported callable SyntaxWarning unsupported callable RuntimeWarning unsupported callable FutureWarning unsupported callable ImportWarning unsupported callable UnicodeWarning unsupported callable BytesWarning unsupported callable ResourceWarning unsupported callable ConnectionError unsupported callable BlockingIOError unsupported callable BrokenPipeError unsupported callable ChildProcessError unsupported callable ConnectionAbortedError unsupported callable ConnectionRefusedError unsupported callable ConnectionResetError unsupported callable FileExistsError unsupported callable FileNotFoundError unsupported callable IsADirectoryError unsupported callable NotADirectoryError unsupported callable InterruptedError unsupported callable PermissionError unsupported callable ProcessLookupError unsupported callable TimeoutError unsupported callable ```
msg308500 - (view) Author: Meador Inge (meador.inge) * (Python committer) Date: 2017-12-17 20:34
This is a documented limitation for CPython: https://docs.python.org/3.7/library/inspect.html#inspect.signature
msg308520 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2017-12-18 07:16
This was documented for the “getfullargspec” function in Issue 7422 (long before “signature” existed). The error message was also clarified in Issue 6905. However IMO the term “Python function” is too subtle and ambiguous.
msg326076 - (view) Author: thautwarm (thautwarm) * Date: 2018-09-22 05:25
Maybe a few adjustments to this one?
History
Date User Action Args
2022-04-11 14:58:55 admin set github: 76533
2020-02-18 14:56:12 thautwarm set status: open -> closedstage: resolved
2018-09-22 05:25:05 thautwarm set messages: +
2017-12-18 07:16:04 martin.panter set nosy: + martin.pantermessages: +
2017-12-17 20:34:49 meador.inge set nosy: + meador.ingemessages: +
2017-12-17 13:47:09 thautwarm create