-
Notifications
You must be signed in to change notification settings - Fork 905
remove private types from pyo3-ffi
#5064
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
mejrs
left a comment
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.
Thanks! Were you planning to just limit this to underscore apis? There are things like PyCodeObject and PyHeapTypeObject that aren't exactly public api either.
As per #5064 (comment) have made There are definitely other structures which should not be public, but given that each time we change this we might break downstream code I would prefer to just remove these when there's a good reason, e.g. the CPython headers hide the symbol or explicitly document as private API. Also if we removed |
mejrs
left a comment
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.
Thanks, that's a nice line diff.
|
Wholeheartedly agree, especially when CPython's C interfaces changes in prerelease builds! |
|
@davidhewitt the auto merge didn't quite work: |
|
Thanks, I've decided to fix by restricting visibility of |
|
Let's try to merge once again. |
|
Windows build failed with: |
|
I'm just going to remove that function; if we can't depend on the layout of |
* remove private types from `pyo3-ffi` * newsfragments * make `PyCodeObject` opaque on all versions * fix msrv * fix msrv, try 2 * remove unused constant * sync `cpython/compile.rs` with header at 3.13 * fix size of INT_MAX * remove `PyCode_GetNumFree`
Thanks to the typos[1] tool! Previously _PyCoMontoringData was ignored as part of PyO3#5064[2], which is obviously the wrong name. This PR changes it for the real _PyCoMonitoringData name, but since it should be private that shouldn’t affect any real user of the ffi crate. [1] https://github.com/crate-ci/typos [2] PyO3#5064
Thanks to the typos[1] tool! Previously _PyCoMontoringData was ignored as part of #5064[2], which is obviously the wrong name. This PR changes it for the real _PyCoMonitoringData name, but since it should be private that shouldn’t affect any real user of the ffi crate. [1] https://github.com/crate-ci/typos [2] #5064
Related to #4379, also closes #5062
This PR removes all types and structures starting with
_Pyfrompyo3-ffi. These are private and may be freely altered in patch releases (as seen in #5062), so we should not expose these to users, and should only bother defining them inpyo3-ffiwhen they're necessary to satisfy public CPython ABI.As part of this PR I changed the
opaque_struct!macro to require explicitly opting-in topub(orpub(crate)), rather than always making the defined item public.