Skip to content

Conversation

@msullivan
Copy link
Contributor

@msullivan msullivan commented Feb 16, 2022

Since #8405, @classmethod now has special case behavior to call its
argument's tp_descr_get if it exists. This breaks wrapping a bound
method with it, since bound method's have a do-nothing tp_descr_get.

Drop that do-nothing tp_descr_get.

https://bugs.python.org/issue46764

Since python#8405, @classmethod now has special case behavior to call its
argument's tp_descr_get if it exists. This breaks wrapping a bound
method with it, since bound method's have a do-nothing tp_descr_get.

Drop that do-nothing tp_descr_get.
@msullivan
Copy link
Contributor Author

Looking at the history, it looks like method_descr_get used to handle unbound methods. This became dead in python 3, and that logic was cleaned up in #12169, but I think it should basically be sound to just drop it.

(Of course, things that directly check for the presence of __get__, like classmethod, will be affected)

@rhettinger rhettinger self-assigned this Feb 17, 2022
Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rhettinger do you still want to look at this? Would be good to get it in before the feature freeze (this Friday).

@JelleZijlstra JelleZijlstra added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label May 2, 2022
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @JelleZijlstra for commit fcbe203 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label May 2, 2022
@rhettinger
Copy link
Contributor

@JelleZijlstra I'm holding off on this one for a bit. As a bug fix, it can be committed after the feature freeze. The contending issue is that I'm working on deprecating the behavior — it is hard to use, it broke too many things, the fixed are making it worse, and since 3.10 we have a viable clean alternate path using __wrapped.

@JelleZijlstra
Copy link
Member

Right, the descriptor behavior of classmethod has been problematic (#89519 (comment) for reference). I'll leave this to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants