File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -491,11 +491,16 @@ def _get_params(func: Callable) -> dict[str, inspect.Parameter]:
491491 # we're out of ideas and should just re-raise the exception.
492492 raise
493493 else :
494- # If the params we got look like an uninformative placeholder, try fallbacks.
495494 P = inspect .Parameter
496495 placeholder = [("args" , P .VAR_POSITIONAL ), ("kwargs" , P .VAR_KEYWORD )]
497- if [(p .name , p .kind ) for p in params ] == placeholder :
498- params = _get_params_ufunc (func ) or _get_params_builtin_fn (func ) or params
496+ if ufunc_params := _get_params_ufunc (func ):
497+ # If func is a ufunc, prefer _get_params_ufunc over get_signature,
498+ # as the latter includes keyword arguments we aren't well-equipped
499+ # to ghostwrite.
500+ params = ufunc_params
501+ elif [(p .name , p .kind ) for p in params ] == placeholder :
502+ # If the params we got look like an uninformative placeholder, try fallbacks.
503+ params = _get_params_builtin_fn (func ) or params
499504 return _params_to_dict (params )
500505
501506
You can’t perform that action at this time.
0 commit comments