Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Changed behavior of <instancemethod>.__get__ in Python 3.11 #113157

Open
Assignees
rhettinger
Labels
type-bugAn unexpected behavior, bug, or error
@mschmitzer

Description

@mschmitzer

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

Linked PRs

Metadata

Metadata

Assignees

Labels

type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp