GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-92678: Fix tp_dictoffset inheritance. by markshannon · Pull Request #95596 · python/cpython

Conversation

@markshannon

@markshannon markshannon commented Aug 3, 2022 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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

  • Issue: MRO: Behavior change from 3.10 to 3.11: multiple inheritance issue with C-API (pybind11) #92678

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
markshannon added 3 commits August 3, 2022 14:36
@markshannon
Add failing test for inheriting explicit __dict__ and weakref.
8baced5
@markshannon
Restore 3.10 for multiple inheritance of C extension classes that sto…
a95417a
…re their dictionary at the end of the struct.
@markshannon
Add news
6fe801e
@markshannon
markshannon requested a review from encukou August 3, 2022 13:41
@bedevere-bot bedevere-bot added the awaiting core review label Aug 3, 2022
@markshannon markshannon mentioned this pull request Aug 3, 2022
gh-92678: Fix MRO calculation for C extension types with manual __dict__ #95242
Closed
@markshannon
Add comment
24ed566
@Fidget-Spinner Fidget-Spinner mentioned this pull request Aug 3, 2022
Flawed assumptions about tp_dictoffset in inheritance. #95589
Closed
encukou
encukou approved these changes Aug 3, 2022
View reviewed changes

@encukou encukou left a comment

Copy link
Copy Markdown
Member

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.

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Aug 3, 2022
@markshannon

markshannon commented Aug 3, 2022

Copy link
Copy Markdown
Member Author

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

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ericsnowcurrently
ericsnowcurrently reviewed Aug 3, 2022
View reviewed changes

@ericsnowcurrently ericsnowcurrently left a comment

Copy link
Copy Markdown
Member

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.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Objects/typeobject.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Objects/typeobject.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@markshannon @ericsnowcurrently
PEP 7 formatting
a7c2008
Co-authored-by: Eric Snow <[email protected]>
@pablogsal pablogsal mentioned this pull request Aug 3, 2022
MRO: Behavior change from 3.10 to 3.11: multiple inheritance issue with C-API (pybind11) #92678
Closed
@markshannon
Add another comment.
0b52db9
@markshannon markshannon added the needs backport to 3.11 only security fixes label Aug 3, 2022
@markshannon
markshannon merged commit 906e450 into python:main Aug 3, 2022
@miss-islington

miss-islington commented Aug 3, 2022

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed the awaiting merge label Aug 3, 2022
@miss-islington

miss-islington commented Aug 3, 2022

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington miss-islington assigned markshannon Aug 3, 2022
@markshannon markshannon mentioned this pull request Aug 3, 2022
[3.11] GH-92678: Fix tp_dictoffset inheritance. Backport of GH-95596 #95604
Merged
markshannon added a commit to faster-cpython/cpython that referenced this pull request Aug 3, 2022
@markshannon
pythonGH-92678: Fix tp_dictoffset inheritance. (pythonGH-95596)
53093f3
* 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

vstinner commented Aug 3, 2022

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

markshannon added a commit that referenced this pull request Aug 4, 2022
@markshannon
GH-92678: Fix tp_dictoffset inheritance. (GH-95596) (GH-95604)
2ab5601
* 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
@terryjreedy terryjreedy changed the title GH-92678: Fix tp_dictoffset inheritance. gh-92678: Fix tp_dictoffset inheritance. Feb 18, 2025
@terryjreedy

terryjreedy commented Feb 18, 2025

Copy link
Copy Markdown
Member

PR #95604 is merged 3.11 backport.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

@ericsnowcurrently ericsnowcurrently ericsnowcurrently left review comments
@encukou encukou encukou approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@markshannon markshannon

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@markshannon @miss-islington @vstinner @terryjreedy @encukou @ericsnowcurrently @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.