Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
|
Will this break the pattern described as an alternative to abc.abstractclassmethod? |
Sorry, something went wrong.
|
@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. |
Sorry, something went wrong.
|
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. 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). |
Sorry, something went wrong.
|
@itamaro Thank you for your comment. Indeed, it does increase the confidence in the PR. |
Sorry, something went wrong.
|
🤖 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. |
Sorry, something went wrong.
📚 Documentation preview 📚: https://cpython-previews--110163.org.readthedocs.build/