We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1fd7bb5 commit 3913171Copy full SHA for 3913171
src/random.rs
@@ -82,16 +82,8 @@ unsafe impl PyTypeInfo for PyBitGenerator {
82
fn type_object_raw<'py>(py: Python<'py>) -> *mut ffi::PyTypeObject {
83
static CLS: GILOnceCell<Py<PyType>> = GILOnceCell::new();
84
let cls = CLS
85
- .get_or_try_init::<_, PyErr>(py, || {
86
- Ok(py
87
- .import("numpy.random")?
88
- .getattr("BitGenerator")?
89
- .downcast_into::<PyType>()?
90
- .unbind())
91
- })
92
- .expect("Failed to get BitGenerator type object")
93
- .clone_ref(py)
94
- .into_bound(py);
+ .import(py, "numpy.random", "BitGenerator")
+ .expect("Failed to get BitGenerator type object");
95
cls.as_type_ptr()
96
}
97
0 commit comments