Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34k
gh-82062: correctly set module for built-in instance methods in inspect.signature()#115270
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
gh-82062: correctly set module for built-in instance methods in inspect.signature()#115270
Uh oh!
There was an error while loading.Please reload this page.
Conversation
… inspect.signature()The ``__module__`` attribute is missing for instance methods in extensionmodules, so instead we use in this case ``__objclass__.__module__``.
skirpichev commentedFeb 11, 2024
Alternatively, we could set the >>>int.to_bytes.__module__Traceback (most recent call last): File "<stdin>", line 1, in <module>AttributeError: 'method_descriptor' object has no attribute '__module__'. Did you mean: '__reduce__'? |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Misc/NEWS.d/next/Library/2024-02-11-07-31-43.gh-issue-82062.eeS6w7.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
skirpichev commentedApr 30, 2024
@serhiy-storchaka, I hope I did requested changes. |
Misc/NEWS.d/next/Library/2024-02-11-07-31-43.gh-issue-82062.eeS6w7.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Misc/NEWS.d/next/Library/2024-02-11-07-31-43.gh-issue-82062.eeS6w7.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Misc/NEWS.d/next/Library/2024-02-11-07-31-43.gh-issue-82062.eeS6w7.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
…S6w7.rstCo-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
serhiy-storchaka left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM.
…sion modules (pythonGH-115270)Now inspect.signature() supports references to the module globals inparameter defaults on methods in extension modules. Previously it wasonly supported in functions. The workaround was to specify the fullyqualified name, including the module name.
Uh oh!
There was an error while loading.Please reload this page.
The
__module__attribute is missing for instance methods in extension modules, so instead we use in this case__objclass__.__module__.