Skip to content

gh-92678: Fix tp_dictoffset inheritance. - #95596

Merged
markshannon merged 6 commits into
python:mainfrom
faster-cpython:fix-dictoffset-inheritance
Aug 3, 2022
Merged

gh-92678: Fix tp_dictoffset inheritance.#95596
markshannon merged 6 commits into
python:mainfrom
faster-cpython:fix-dictoffset-inheritance

Conversation

@markshannon

@markshannonmarkshannon commented Aug 3, 2022

Copy link
Copy Markdown
Member

Restores the 3.10 behavior for inheriting tp_dictoffset involving multiple inheritance of C extension classes.

@encukouencukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't check there aren't more edge cases, but this is an improvement, and should address the pybind11 issue.

@markshannon

Copy link
Copy Markdown
MemberAuthor

I can't check there aren't more edge cases

Any ideas? I'd be very happy to add more tests

@ericsnowcurrentlyericsnowcurrently left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly LGTM

The new test seems fine, but I didn't look at it thoroughly. I left one comment (about a second case for weaklistoffset) that should definitely be address one way or another.

Comment threadObjects/typeobject.c Outdated
Comment threadObjects/typeobject.c
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
@markshannonmarkshannon added the needs backport to 3.11 only security fixes label Aug 3, 2022
@markshannon
markshannon merged commit 906e450 into python:mainAug 3, 2022
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @markshannon for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@miss-islington

Copy link
Copy Markdown
Contributor

Sorry, @markshannon, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 906e4509328917fe9951f85457897f6a841e0529 3.11

markshannon added a commit to faster-cpython/cpython that referenced this pull request Aug 3, 2022
* Add test for inheriting explicit __dict__ and weakref.
* Restore 3.10 behavior for multiple inheritance of C extension classes that store their dictionary at the end of the struct.
@vstinner

Copy link
Copy Markdown
Member

I cannot review the implementation, but thanks for adding tests! #92678 looked complicated and serious. Thanks for fixing it ;-)

markshannon added a commit that referenced this pull request Aug 4, 2022
* Add test for inheriting explicit __dict__ and weakref.
* Restore 3.10 behavior for multiple inheritance of C extension classes that store their dictionary at the end of the struct.
@markshannon
markshannon deleted the fix-dictoffset-inheritance branch September 26, 2023 12:55
@terryjreedyterryjreedy changed the title GH-92678: Fix tp_dictoffset inheritance.gh-92678: Fix tp_dictoffset inheritance.Feb 18, 2025
@terryjreedy

Copy link
Copy Markdown
Member

PR #95604 is merged 3.11 backport.

@terryjreedyterryjreedy removed the needs backport to 3.11 only security fixes label Feb 18, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@markshannon@miss-islington@vstinner@terryjreedy@encukou@ericsnowcurrently@bedevere-bot