GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||
GeezerVison is showing github.com — gh-121027: Make the functools.partial object a method descriptor by serhiy-storchaka · Pull Request #121089 · python/cpython Conversation
|
|
This should have been labeled as "DO-NOT-MERGE" until #121086 was merged. There are conflicts anyway now. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Co-authored-by: d.grigonis <[email protected]>
693fbc7 to
d752505
Compare
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.
The reason will be displayed to describe this comment to others. Learn more.
It was needed to avoid emitting a warning for partialmethod(partial(...)), even if the final behavior is not changed.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
pythonGH-121089) Co-authored-by: d.grigonis <[email protected]>
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.
|
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 . |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
#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).
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.