← 返回首页
gh-89519: Remove classmethod descriptor chaining, deprecated since 3.11 by rhettinger · Pull Request #110163 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

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

Provide feedback

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

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

gh-89519: Remove classmethod descriptor chaining, deprecated since 3.11#110163

Merged
rhettinger merged 6 commits into
python:mainfrom
rhettinger:remove_classmethod_descriptor_chaining
Oct 27, 2023
Merged

gh-89519: Remove classmethod descriptor chaining, deprecated since 3.11#110163
rhettinger merged 6 commits into
python:mainfrom
rhettinger:remove_classmethod_descriptor_chaining

Conversation

rhettinger commented Sep 30, 2023
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Contributor

rhettinger added type-bug An unexpected behavior, bug, or error 3.13 bugs and security fixes labels Sep 30, 2023

Copy link
Copy Markdown
Contributor Author

I'm still working on the doctest for the descriptor howto. It looks like the classmethod emulation is imperfect after the classproperty has been removed.

Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor Author

@KevinMGranger The examples for combining abstractmethod with classmethod and staticmethod will still work. This is tested in test_abstractclassmethod_basics() in Lib/test/test_abc. Also, here's a live demonstration:

% ./python.exe Python 3.13.0a0 (heads/remove_classmethod_descriptor_chaining:8336eb0b87, Oct 24 2023, 14:41:05) [Clang 15.0.0 (clang-1500.0.40.1)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from abc import ABC, abstractmethod >>> class C(ABC): ... @classmethod ... @abstractmethod ... def my_abstract_classmethod(cls, arg): ... ... ... >>> C() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: Can't instantiate abstract class C without an implementation for abstract method 'my_abstract_classmethod'

Note, these examples have worked since Python 3.3 which was long before the broken descriptor chaining arrived in Python 3.9. So, they are independent of the change being reverted. Thanks for asking.

facebook-github-bot pushed a commit to facebookincubator/cinder that referenced this pull request Oct 25, 2023
…11 (#110163) Summary: backporting [Raymond Hettinger's `remove_classmethod_descriptor_chaining` branch](https://github.com/rhettinger/cpython/tree/remove_classmethod_descriptor_chaining) (pending upstream PR [GH-110163](python/cpython#110163)), part of upstream issue [GH-89519](python/cpython#89519) Reviewed By: swtaarrs Differential Revision: D50534886 fbshipit-source-id: 05b29193ce220f0d91fd0df8d5cef34d7e923456

itamaro commented Oct 26, 2023

Copy link
Copy Markdown
Contributor

Looking forward to see this getting merged!

fwiw, I ran into an issue related to classmethod descriptor chaining in the Meta codebase -- some code (that was written for Python 3.8, doing a bunch of signature and type inspection of decorated methods) started breaking under Python 3.10.
I backported the deprecation from 3.11 and this removal into Cinder 3.10, and it resolved the issue.

If it helps with confidence in the removal - this PR (cleanly backported to 3.10) is running in production (in Instagram and other Meta Python services), after all internal test suites passed (including the full Instagram test suite).

Copy link
Copy Markdown
Contributor Author

@itamaro Thank you for your comment. Indeed, it does increase the confidence in the PR.

rhettinger added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 27, 2023

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @rhettinger for commit 291ed52 🤖

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

bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 27, 2023
rhettinger merged commit 7f9a99e into python:main Oct 27, 2023
rhettinger deleted the remove_classmethod_descriptor_chaining branch October 27, 2023 05:25
facebook-github-bot pushed a commit to facebookincubator/cinder that referenced this pull request Dec 22, 2023
…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
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
copybara-service Bot pushed a commit to google/fiddle that referenced this pull request Jan 12, 2026
…a new dedicated `AutoConfigClassMethod` descriptor. This is necessary because Python 3.13 no longer recognizes descriptor chaining: python/cpython#110163 PiperOrigin-RevId: 855235679
copybara-service Bot pushed a commit to google/fiddle that referenced this pull request Jan 12, 2026
…a new dedicated `AutoConfigClassMethod` descriptor. This is necessary because Python 3.13 no longer recognizes descriptor chaining: python/cpython#110163 PiperOrigin-RevId: 855235679
copybara-service Bot pushed a commit to google/fiddle that referenced this pull request Jan 13, 2026
…a new dedicated `AutoConfigClassMethod` descriptor. This is necessary because Python 3.13 no longer recognizes descriptor chaining: python/cpython#110163 PiperOrigin-RevId: 855235679
copybara-service Bot pushed a commit to google/fiddle that referenced this pull request Jan 13, 2026
…a new dedicated `AutoConfigClassMethod` descriptor. This is necessary because Python 3.13 no longer recognizes descriptor chaining: python/cpython#110163 PiperOrigin-RevId: 855235679
copybara-service Bot pushed a commit to google/fiddle that referenced this pull request Jan 15, 2026
…a new dedicated `AutoConfigClassMethod` descriptor. This is necessary because Python 3.13 no longer recognizes descriptor chaining: python/cpython#110163 PiperOrigin-RevId: 855235679
copybara-service Bot pushed a commit to google/fiddle that referenced this pull request Jan 15, 2026
…a new dedicated `AutoConfigClassMethod` descriptor. This is necessary because Python 3.13 no longer recognizes descriptor chaining: python/cpython#110163 PiperOrigin-RevId: 855235679
copybara-service Bot pushed a commit to google/fiddle that referenced this pull request Jan 15, 2026
…a new dedicated `AutoConfigClassMethod` descriptor. This is necessary because Python 3.13 no longer recognizes descriptor chaining: python/cpython#110163 PiperOrigin-RevId: 856608179
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.13 bugs and security fixes type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Footer

© 2026 GitHub, Inc.