Skip to content

invalid signature for math.hypot #101123

Description

@skirpichev
>>>importmath>>>importinspect>>>inspect.signature(math.hypot) Traceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File"/home/sk/src/cpython/Lib/inspect.py", line3295, insignaturereturnSignature.from_callable(obj, follow_wrapped=follow_wrapped,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"/home/sk/src/cpython/Lib/inspect.py", line3039, infrom_callablereturn_signature_from_callable(obj, sigcls=cls,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"/home/sk/src/cpython/Lib/inspect.py", line2531, in_signature_from_callablereturn_signature_from_builtin(sigcls, obj,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"/home/sk/src/cpython/Lib/inspect.py", line2330, in_signature_from_builtinraiseValueError("no signature found for builtin {!r}".format(func))
ValueError: nosignaturefoundforbuiltin<built-infunctionhypot>

This patch works:

diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index 1342162fa7..0e610eb9cb 100644
--- a/Modules/mathmodule.c+++ b/Modules/mathmodule.c@@ -2805,7 +2805,9 @@ math_hypot(PyObject *self, PyObject *const *args, Py_ssize_t nargs)
#undef NUM_STACK_ELEMS
PyDoc_STRVAR(math_hypot_doc,
- "hypot(*coordinates) -> value\n\n\+ "hypot($module, *coordinates)\n\+--\n\+\n\
Multidimensional Euclidean distance from the origin to a point.\n\
\n\
Roughly equivalent to:\n\

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions