Skip to content

Conversation

@davidhewitt
Copy link
Member

Part of #5592

Synchronize the pystate declarations with Python 3.14

@davidhewitt
Copy link
Member Author

🎉 looks like CI is finally green here.

@ngoldbaum
Copy link
Contributor

I'll try to take a look today. I'm doing other pyo3-ffi stuff right now so all this is fresh for me.

Copy link
Contributor

@ngoldbaum ngoldbaum left a comment

Choose a reason for hiding this comment

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

Looks good. I have some minor suggestions inline but feel free to ignore. I verified that the definitions all follow the CPython headers as of 3.14. There are more changes in 3.15 though 🙈.

pub(crate) fn _PyThreadState_UncheckedGet() -> *mut PyThreadState;

// skipped PyThreadState_EnterTracing
// skipped PyThreadState_LeaveTracing
Copy link
Contributor

Choose a reason for hiding this comment

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

why skip these? someone writing a profiler might want this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will add 👍

// skipped private _PyThread_CurrentFrames

// skipped PyUnstable_ThreadState_SetStackProtection
// skipped PyUnstable_ThreadState_ResetStackProtection
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here - seems reasonable to expose these to me.

Copy link
Member Author

Choose a reason for hiding this comment

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

For this one I am going to skip for now, just because "unstable" APIs seem to imply they're more likely to have churn so I'm tempted to wait to take on the maintenance burden until someone asks to use these.

@davidhewitt davidhewitt enabled auto-merge January 10, 2026 14:54
@davidhewitt
Copy link
Member Author

Thanks! I guess for the 3.15 changes I can never quite decide when the appropriate "sync" point is. My instinct is that before 3.15.0 we can make changes to the headers to begin accomodating the upcoming version and otherwise the 3.14 headers are the best reference point.

@davidhewitt davidhewitt added this pull request to the merge queue Jan 10, 2026
Merged via the queue into PyO3:main with commit b527ee8 Jan 10, 2026
69 of 78 checks passed
@davidhewitt davidhewitt deleted the sync-pystate branch January 10, 2026 19:32
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.

2 participants