Uh oh!
There was an error while loading. Please reload this page.
gh-121027: Make the functools.partial object a method descriptor - #121089
Conversation
5ecccee to
693fbc7CompareThis should have been labeled as "DO-NOT-MERGE" until #121086 was merged. There are conflicts anyway now. |
Co-authored-by: d.grigonis <dgrigonis@users.noreply.github.com>
693fbc7 to
d752505CompareUh oh!
There was an error while loading. Please reload this page.
| get = getattr(self.func, "__get__", None) | ||
| result = None | ||
| if get is not None and not isinstance(self.func, partial): | ||
| if get is not None: |
There was a problem hiding this comment.
It was needed to avoid emitting a warning for partialmethod(partial(...)), even if the final behavior is not changed.
Uh oh!
There was an error while loading. Please reload this page.
bedevere-bot
commented
Jul 3, 2024
|
pythonGH-121089) Co-authored-by: d.grigonis <dgrigonis@users.noreply.github.com>
pythonGH-121089) Co-authored-by: d.grigonis <dgrigonis@users.noreply.github.com>
PR #121089 added an eager import for types.MethodType, but still left the existing hacks for lazily importing from types. We could also create MethodType internally in functools.py (e.g., by using `type(Placeholder.__repr__)`, but it feels not worth it at this point, so instead I unlazified all the usages of types in the module.
MegaIng
commented
Oct 25, 2024
May I ask why this change was considered critical enough to not follow PEP 387? It is clearly backwards incompatible and is in fact breaking code, see lark-parser/lark#1480 . |
#2546 is blocked because we don't run the tests on this branch with Python 3.14, but these are configured as required checks. Since Ops 2.23 only specifies Python `>=3.8`, we'd expect it to run fine with Python 3.14. In addition to adding 3.14 to the list of versions in CI, we also need to add it to the list of environments in `tox.ini`, and follow #2091 in patching some of the tests: we now need to wrap our `functools.partial` objects in `staticmethod` due to `partial` implementing the decriptor protocol in Python 3.14 (python/cpython#121027, python/cpython#121089). However, because we're on an older `pyright` version in this maintenance branch, this leads to type checking errors which we ignore (bumping `pyright` resolves this but introduces 20+ other errors which would add noise to this PR).
Co-authored-by: d.grigonis dgrigonis@users.noreply.github.com
📚 Documentation preview 📚: https://cpython-previews--121089.org.readthedocs.build/