Skip to content

Commit

Permalink
Disambiguate a few more Arbitrary Self Types
Browse files Browse the repository at this point in the history
  • Loading branch information
LilyFoote committed Feb 2, 2025
1 parent f1aa49c commit ac8a477
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyo3-macros-backend/src/intopyobject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ impl<'a> Container<'a> {
.unwrap_or_else(|| f.ident.unraw().to_string());
let value = Ident::new(&format!("arg{i}"), f.field.ty.span());
quote! {
dict.set_item(#key, #value)?;
#pyo3_path::types::PyDict::set_item(&dict, #key, #value)?;
}
})
.collect::<TokenStream>();
Expand Down
4 changes: 2 additions & 2 deletions src/tests/hygiene/pymodule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ fn foo(
#[crate::pymodule]
#[pyo3(crate = "crate")]
fn my_module(m: &crate::Bound<'_, crate::types::PyModule>) -> crate::PyResult<()> {
m.add_function(crate::wrap_pyfunction!(do_something, m)?)?;
m.add_wrapped(crate::wrap_pymodule!(foo))?;
crate::types::PyModule::add_function(m, crate::wrap_pyfunction!(do_something, m)?)?;
crate::types::PyModule::add_wrapped(m, crate::wrap_pymodule!(foo))?;

::std::result::Result::Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/forbid_unsafe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ mod from_py_with {
use pyo3::types::PyBytes;

fn bytes_from_py(bytes: &Bound<'_, PyAny>) -> PyResult<Vec<u8>> {
Ok(bytes.downcast::<PyBytes>()?.as_bytes().to_vec())
Ok(PyBytes::as_bytes(bytes.downcast::<PyBytes>()?).to_vec())
}

#[pyfunction]
Expand Down

0 comments on commit ac8a477

Please sign in to comment.