Skip to content
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

fix __dict__ on Python 3.9 with limited API #4251

Merged
merged 4 commits into from
Jun 16, 2024

Conversation

davidhewitt
Copy link
Member

Found in CI trying to merge #4194

It looks like we knew about this in test cases already; when I originally implemented #[pyclass(dict)] for abi3 in #1342 I set these test cases to be ignored.

The problem is that PyObject_GenericGetDict doesn't exist in the limited API until Python 3.10. In this PR, instead of omitting the attribute we build a basic implementation of PyObject_GenericGetDict which works for our need.

Copy link
Contributor

@Icxolu Icxolu left a comment

Choose a reason for hiding this comment

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

LGTM, just a few style suggestions.

newsfragments/4251.fixed.md Show resolved Hide resolved
pytests/src/pyclasses.rs Outdated Show resolved Hide resolved
src/pyclass/create_type_object.rs Outdated Show resolved Hide resolved
src/pyclass/create_type_object.rs Outdated Show resolved Hide resolved
src/pyclass/create_type_object.rs Outdated Show resolved Hide resolved
tests/test_class_basics.rs Show resolved Hide resolved
@davidhewitt
Copy link
Member Author

Thanks for the review, I'll try to address all points tonight 👍

@davidhewitt davidhewitt mentioned this pull request Jun 15, 2024
5 tasks
davidhewitt and others added 2 commits June 15, 2024 23:02
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
@davidhewitt davidhewitt added this pull request to the merge queue Jun 16, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 16, 2024
@davidhewitt davidhewitt added this pull request to the merge queue Jun 16, 2024
Merged via the queue into PyO3:main with commit 0b2f19b Jun 16, 2024
41 checks passed
@davidhewitt davidhewitt deleted the 3.9-dict branch June 16, 2024 08:46
Sign up for free to 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.

None yet

2 participants