Skip to content

Conversation

@youknowone
Copy link

I’ve added a new commit on top of #17.

I’m not claiming that PyRc introduced in this patch represents ideal design. But I think it’s sufficient to demonstrate how we can have a type with the same memory layout as *mut PyObject while automatically handling DecRef.

Since these types don’t belong in cpython-sys, we’ll need a separate crate for the public API.

}

fn standard_b64encode_impl(source: &PyObject) -> Result<*mut PyObject, ()> {
fn standard_b64encode_impl(source: &PyObject) -> Result<PyRc, ()> {
Copy link
Author

Choose a reason for hiding this comment

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

&PyObject means it guarantees the RC count is never changed in this logic. (not 100% because it can be changed in C side)
PyRc means it can be increased or decreased.

@youknowone youknowone marked this pull request as ready for review November 25, 2025 05:54
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.

1 participant