PyModule: filename: use non-deprecated function
This commit is contained in:
parent
aaddb20a22
commit
1c845e7b3b
|
@ -9,7 +9,7 @@ use crate::ffi;
|
||||||
use crate::instance::PyNativeType;
|
use crate::instance::PyNativeType;
|
||||||
use crate::pyclass::PyClass;
|
use crate::pyclass::PyClass;
|
||||||
use crate::type_object::PyTypeObject;
|
use crate::type_object::PyTypeObject;
|
||||||
use crate::types::{PyAny, PyDict, PyList};
|
use crate::types::{PyAny, PyDict, PyList, PyString};
|
||||||
use crate::types::{PyCFunction, PyTuple};
|
use crate::types::{PyCFunction, PyTuple};
|
||||||
use crate::{AsPyPointer, IntoPy, Py, PyObject, Python};
|
use crate::{AsPyPointer, IntoPy, Py, PyObject, Python};
|
||||||
use std::ffi::{CStr, CString};
|
use std::ffi::{CStr, CString};
|
||||||
|
@ -122,10 +122,9 @@ impl PyModule {
|
||||||
#[cfg(not(all(windows, PyPy)))]
|
#[cfg(not(all(windows, PyPy)))]
|
||||||
pub fn filename(&self) -> PyResult<&str> {
|
pub fn filename(&self) -> PyResult<&str> {
|
||||||
unsafe {
|
unsafe {
|
||||||
self.str_from_ptr(
|
self.py()
|
||||||
#[allow(deprecated)]
|
.from_owned_ptr_or_err::<PyString>(ffi::PyModule_GetFilenameObject(self.as_ptr()))?
|
||||||
ffi::PyModule_GetFilename(self.as_ptr()),
|
.to_str()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue