Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.4k
Open
Description
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:
classA:defmeth(self):print(self)classB:passa=A()b=B()b.meth=a.meth.__get__(b,B)b.meth()
Theb.meth()
call receivesa
as theself
argument up to Python 3.10, butb
in 3.11 and 3.12.
This pattern isused by the Pyramid framework. The change breaks Pyramid applications that useadd_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