Skip to content

Commit

Permalink
Use PyModule_NewObject
Browse files Browse the repository at this point in the history
  • Loading branch information
bschoenmaeckers committed Aug 13, 2024
1 parent 1d06e76 commit ec245a9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/types/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,8 @@ impl PyModule {
/// # Ok(())}
/// ```
pub fn new<'py>(py: Python<'py>, name: &str) -> PyResult<Bound<'py, PyModule>> {
// Could use PyModule_NewObject, but it doesn't exist on PyPy.
let name = CString::new(name)?;
unsafe {
ffi::PyModule_New(name.as_ptr())
ffi::PyModule_NewObject(name.into_py(py))
.assume_owned_or_err(py)
.downcast_into_unchecked()
}
Expand Down

0 comments on commit ec245a9

Please sign in to comment.