PyO3 / PyO3/pyo3

Expose FfiPtrExt methods as public API

Open
#3,965 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
16.2k
Forks
1k
Avg merge
2d 6h
Merged PRs (30d)
66

Description

what i want to have in my codebase:

let ptr = ffi::PyList_New(len);
let list: Bound<'_, PyList> = ptr.assume_owned(py).downcast_into_unchecked();

what i have:

let ptr = ffi::PyList_New(len);
let list: Bound<'_, PyList> = Bound::from_owned_ptr(py, ptr).downcast_into_unchecked();

where private assume_owned is just:

#[inline]
unsafe fn assume_owned(self, py: Python<'_>) -> Bound<'_, PyAny> {
    Bound::from_owned_ptr(py, self)
}

any particular reason to make FfiPtrExt private while we have public Bound?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the private FfiPtrExt and comparing its assume_owned method with the shown Bound::from_owned_ptr call. Inspect how the method's visibility affects the public API. Done means the requested FfiPtrExt methods are publicly usable while preserving the existing ownership conversion behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.