Skip to content

Commit

Permalink
PyO3: migrate to Bound smart pointer for `src/rust/engine/src/exter…
Browse files Browse the repository at this point in the history
…ns/dep_inference.rs` (#21469)

Migrate to the `Bound` smart pointer instead of `&PyAny` (and related reference types) in `src/rust/engine/src/externs/dep_inference.rs`. See the [PyO3 migration guide](https://pyo3.rs/main/migration#migrating-from-the-gil-refs-api-to-boundt) for details.
  • Loading branch information
tdyas authored Oct 2, 2024
1 parent 76ef3e4 commit a24590b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/rust/engine/src/externs/dep_inference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub(crate) fn register(m: &PyModule) -> PyResult<()> {
pub struct PyInferenceMetadata(pub dependency_inference_request::Metadata);

fn as_import_patterns(
dict: &PyDict,
dict: &Bound<'_, PyDict>,
) -> PyResult<Vec<javascript_inference_metadata::ImportPattern>> {
dict.iter()
.map(|(key, value)| {
Expand All @@ -41,11 +41,11 @@ fn as_import_patterns(
impl PyInferenceMetadata {
#[staticmethod]
#[pyo3(signature = (package_root, import_patterns, config_root, paths))]
fn javascript(
fn javascript<'py>(
package_root: String,
import_patterns: &PyDict,
import_patterns: &Bound<'py, PyDict>,
config_root: Option<String>,
paths: &PyDict,
paths: &Bound<'py, PyDict>,
) -> PyResult<Self> {
let import_patterns = as_import_patterns(import_patterns)?;
let paths = as_import_patterns(paths)?;
Expand Down

0 comments on commit a24590b

Please sign in to comment.