-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
Changed behavior of <instancemethod>.__get__ in Python 3.11 #113157
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
Comments
Bisected to a918589 |
@MarcSchmitzer is correct and the "return a" behavior should be restored. For Python 3.13, this is straightforward. Since classmethod descriptor chaining has now been removed, we can just add back For Python 3.11 and Python 3.12, the situation is more complex and we can't fix any one aspect of the problem without breaking something else. Here are the options that come to mind:
|
…escriptor chaining was introduced.
@msullivan Would you be okay with reverting a918589 ? We wouldn't have gone down that path had we known that it would break another part of the API. |
For 3.11 and 3.12, I suggest that we revert a918589 Any objections? |
cc. @pablogsal as 3.11 RM, and @Yhg1s as 3.12 RM. |
…ted since 3.11) Summary: backport upstream PRs python/cpython#110163 and python/cpython#113233 upstream issues: python/cpython#89519 (Calling help executes classmethod property decorated methods) and python/cpython#113157 (Changed behavior of <instancemethod>.__get__ in Python 3.11) upstream commits: [`7f9a99e8549b792662f2cd28bf38a4d4625bd402`](python/cpython@7f9a99e) and [`d058eaeed44766a8291013b275ad22f153935d3b`](python/cpython@d058eae) Reviewed By: aleivag Differential Revision: D52014322 fbshipit-source-id: 87de6d9587bd9cc49f053ca340adfc469b041f91
Restore behaviors before classmethod descriptor chaining was introduced.
Restore behaviors before classmethod descriptor chaining was introduced.
Restore behaviors before classmethod descriptor chaining was introduced.
Restore behaviors before classmethod descriptor chaining was introduced.
Bug report
Bug description:
There is a change in behavior in Python 3.11 that does not seem to be described in the "what's new" document.
In the following code:
The
b.meth()
call receivesa
as theself
argument up to Python 3.10, butb
in 3.11 and 3.12.This pattern is used by the Pyramid framework. The change breaks Pyramid applications that use
add_request_method(someobject.somemethod, "name")
.I have to admit that I do not understand the descriptor protocol (or the documentation of
__get__
) well enough to say whether this is a legitimate use case, but it does exist in the wild.CPython versions tested on:
3.9, 3.10, 3.11, 3.12
Operating systems tested on:
Linux
Linked PRs
The text was updated successfully, but these errors were encountered: