-
-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Open
Labels
Description
Describe the issue:
when I try to use inspect.getfullargspec to get np.any, raises unsupported callable
Reproduce the code example:
import numpy as np
import inspect
import sys
print(np.__version__); print(sys.version)
inspect.getfullargspec(getattr(np, 'any'))Error message:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
File ~/anaconda3/lib/python3.10/inspect.py:1285, in getfullargspec(func)
1268 try:
1269 # Re: `skip_bound_arg=False`
1270 #
(...)
1282 # getfullargspec() historically ignored __wrapped__ attributes,
1283 # so we ensure that remains the case in 3.3+
-> 1285 sig = _signature_from_callable(func,
1286 follow_wrapper_chains=False,
1287 skip_bound_arg=False,
1288 sigcls=Signature,
1289 eval_str=False)
1290 except Exception as ex:
1291 # Most of the times 'signature' will raise ValueError.
1292 # But, it can also raise AttributeError, and, maybe something
1293 # else. So to be fully backwards compatible, we catch all
1294 # possible exceptions here, and reraise a TypeError.
File ~/anaconda3/lib/python3.10/inspect.py:2467, in _signature_from_callable(obj, follow_wrapper_chains, skip_bound_arg, globals, locals, eval_str, sigcls)
2466 if _signature_is_builtin(obj):
-> 2467 return _signature_from_builtin(sigcls, obj,
2468 skip_bound_arg=skip_bound_arg)
2470 if isinstance(obj, functools.partial):
File ~/anaconda3/lib/python3.10/inspect.py:2274, in _signature_from_builtin(cls, func, skip_bound_arg)
2273 if not s:
-> 2274 raise ValueError("no signature found for builtin {!r}".format(func))
2276 return _signature_fromstr(cls, func, s, skip_bound_arg)
ValueError: no signature found for builtin <function any at 0x102cd8a30>
The above exception was the direct cause of the following exception:
TypeError Traceback (most recent call last)
Cell In[7], line 1
----> 1 inspect.getfullargspec(getattr(np, 'any'))
File ~/anaconda3/lib/python3.10/inspect.py:1295, in getfullargspec(func)
1285 sig = _signature_from_callable(func,
1286 follow_wrapper_chains=False,
1287 skip_bound_arg=False,
1288 sigcls=Signature,
1289 eval_str=False)
1290 except Exception as ex:
1291 # Most of the times 'signature' will raise ValueError.
1292 # But, it can also raise AttributeError, and, maybe something
1293 # else. So to be fully backwards compatible, we catch all
1294 # possible exceptions here, and reraise a TypeError.
-> 1295 raise TypeError('unsupported callable') from ex
1297 args = []
1298 varargs = None
TypeError: unsupported callableRuntime information:
1.25.0
3.10.9 (main, Mar 1 2023, 12:20:14) [Clang 14.0.6 ]
Context for the issue:
No response