-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
gh-105736: Sync pure python version of OrderedDict with the C version #108098
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🤖 New build scheduled with the buildbot fleet by @rhettinger for commit 4f04b7e 🤖 If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
This reverts commit 4758750.
🤖 New build scheduled with the buildbot fleet by @rhettinger for commit d3179bc 🤖 If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
I can confirm the new tests fail without the fix 👍🏻 One thing I'm trying to find is why we needed the So I guess skipping the |
The
In contrast, the |
By whom can it be called multiple times? I mean, yes, theoretically you can explicitly grab (yes, I agree that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. And the resulting code looks clearer.
Moving the code from __init__
to __new__
can break pickling, but OrderedDict uses full constructor instead of __new__
in pickling, so it is safe from this side.
Thanks @rhettinger for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
GH-108200 is a backport of this pull request to the 3.12 branch. |
GH-108201 is a backport of this pull request to the 3.11 branch. |
…ersion (pythonGH-108098) (cherry picked from commit 20cc90c) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
…ersion (pythonGH-108098) (cherry picked from commit 20cc90c) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
Side note. "gh-" in the title should be in lower case, and the issue number should be separated by a colon from the rest of the text. I think this is the reason why other Raymond's PRs were not automatically linked from the corresponding issue. |
This solves a problem noticed in the referenced issue. When
__init__
is overridden, the C version is still usable but the pure Python version fails. The solution is to have the internal invariants sets up in__new__
rather than__init__
.The original copy/pickle issue still remains.