-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invoking 'help(...)' unexpectedly includes name of internal wrapper function. #122129
Comments
It appears there is an issue with the C implementation: C implementationPython 3.12.2 (main, Mar 19 2024, 10:37:03) [GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import functools
>>> @functools.lru_cache()
... def foo(x): pass
...
>>> help(foo)
Help on _lru_cache_wrapper in module __main__:
foo(x) Python implementationPython 3.12.2 (main, Mar 19 2024, 10:37:03) [GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.modules['_functools'] = None
>>> del sys.modules['functools']
>>> import functools
>>> @functools.lru_cache()
... def foo(x): pass
...
>>> help(foo)
Help on function foo in module __main__:
foo(x) |
@sobolevn You recently had similar observations with |
This is because
We could add a special case for routines in |
It seems that we need to special-case pydoc but I don't know whether it's worth the effort =/ By the way, do you think we should categorize this one as a feature or a bug? (or just close it for now? I can investigate how much effort it would require though) |
I think this is rather a feature request. I mean, it would be nice to backport this change, and it looks harmless, but this is not critical. |
Thank you @serhiy-storchaka! |
Bug report
Bug description:
Attempting to retrieve documentation for the
urlsplit
function mostly works as expected, but the first line is confusing and appears to originate from a caching wrapper applied to the function (not relevant to usage documentation).Note: there is some existing mention of this (
help
and the interaction with the@lru_cache
wrapper) in #88169 - if my report is a dup/invalid, please feel free to close this.CPython versions tested on:
3.12
Operating systems tested on:
Linux
Edit: fixup: add missing statement from interpreter session.
Linked PRs
The text was updated successfully, but these errors were encountered: