Skip to content

update FFI definitions in objimpl.h to not expose private symbols#5591

Merged
davidhewitt merged 3 commits intoPyO3:mainfrom
davidhewitt:ffi-objimpl
Nov 30, 2025
Merged

update FFI definitions in objimpl.h to not expose private symbols#5591
davidhewitt merged 3 commits intoPyO3:mainfrom
davidhewitt:ffi-objimpl

Conversation

@davidhewitt
Copy link
Copy Markdown
Member

Removes private symbols, they are wrapped by macros which do a pointer cast so I've done the same here.

@davidhewitt davidhewitt marked this pull request as ready for review November 29, 2025 15:01
Comment thread pyo3-ffi/src/objimpl.rs
Comment on lines +41 to +44
#[inline]
pub unsafe fn PyObject_New<T>(typeobj: *mut PyTypeObject) -> *mut T {
_PyObject_New(typeobj).cast()
}
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.

This feels a bit weird to do, but I guess that's best approximation of what CPython does.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed, it seemed like the cleanest way to expose the public API.

Comment thread pyo3-ffi/src/objimpl.rs Outdated
Comment thread pyo3-ffi/src/objimpl.rs Outdated
Comment thread pyo3-ffi/src/objimpl.rs Outdated
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
@davidhewitt davidhewitt added this pull request to the merge queue Nov 30, 2025
Merged via the queue into PyO3:main with commit 5fcc5d7 Nov 30, 2025
41 of 43 checks passed
@davidhewitt davidhewitt deleted the ffi-objimpl branch November 30, 2025 12:07
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