Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

invalid signature for math.hypot #101123

Copy link
Copy link
@skirpichev

Description

@skirpichev
Issue body actions
>>> import math
>>> import inspect
>>> inspect.signature(math.hypot) 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sk/src/cpython/Lib/inspect.py", line 3295, in signature
    return Signature.from_callable(obj, follow_wrapped=follow_wrapped,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sk/src/cpython/Lib/inspect.py", line 3039, in from_callable
    return _signature_from_callable(obj, sigcls=cls,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sk/src/cpython/Lib/inspect.py", line 2531, in _signature_from_callable
    return _signature_from_builtin(sigcls, obj,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sk/src/cpython/Lib/inspect.py", line 2330, in _signature_from_builtin
    raise ValueError("no signature found for builtin {!r}".format(func))
ValueError: no signature found for builtin <built-in function hypot>

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

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirC modules in the Modules dirtype-featureA feature request or enhancementA feature request or enhancement
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.