You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
__text_signature__ parser doesn't handle globals in extension module #82062
Building and running e.g. pydoc on this module results in
Traceback (most recent call last):
File ".../lib/python3.7/inspect.py", line 2003, in wrap_value
value =eval(s, module_dict)
File "<string>", line 1, in<module>NameError: name 'ONE'isnot defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ".../lib/python3.7/inspect.py", line 2006, in wrap_value
value =eval(s, sys_module_dict)
File "<string>", line 1, in<module>NameError: name 'ONE'isnot defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ".../lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
<elided>
File ".../lib/python3.7/inspect.py", line 2008, in wrap_value
raiseRuntimeError()
RuntimeError
I think the fix is fairly simple; one needs to replace
Activity
anntzer commentedon Aug 18, 2019
Starting from the custom2 example at https://docs.python.org/3/extending/newtypes_tutorial.html#adding-data-and-methods-to-the-basic-example, change the methods table to
and add a global ONE to the module dict:
Building and running e.g. pydoc on this module results in
Traceback (most recent call last): File ".../lib/python3.7/inspect.py", line 2003, in wrap_value value = eval(s, module_dict) File "<string>", line 1, in <module> NameError: name 'ONE' is not defined During handling of the above exception, another exception occurred: Traceback (most recent call last): File ".../lib/python3.7/inspect.py", line 2006, in wrap_value value = eval(s, sys_module_dict) File "<string>", line 1, in <module> NameError: name 'ONE' is not defined During handling of the above exception, another exception occurred: Traceback (most recent call last): File ".../lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) <elided> File ".../lib/python3.7/inspect.py", line 2008, in wrap_value raise RuntimeError() RuntimeErrorI think the fix is fairly simple; one needs to replace
in inspect.py::_signature_fromstr by
(This is a less general but simpler solution than https://bugs.python.org/issue23967.)
pythongh-82062: correctly set module for built-in instance methods in…
pythongh-82062: correctly set module for built-in instance methods in…
gh-82062: Fix support of parameter defaults on methods in extension m…
pythongh-82062: Fix support of parameter defaults on methods in exten…