ffi: methodobject: PyModule_Check: update for Py39 change

This commit is contained in:
Nicholas Sim 2021-02-13 17:10:29 +08:00
parent 1c845e7b3b
commit 96fcfe6e0c

View file

@ -14,11 +14,18 @@ pub unsafe fn PyCFunction_CheckExact(op: *mut PyObject) -> c_int {
(Py_TYPE(op) == &mut PyCFunction_Type) as c_int (Py_TYPE(op) == &mut PyCFunction_Type) as c_int
} }
#[cfg(Py_3_9)]
#[inline] #[inline]
pub unsafe fn PyCFunction_Check(op: *mut PyObject) -> c_int { pub unsafe fn PyCFunction_Check(op: *mut PyObject) -> c_int {
PyObject_TypeCheck(op, &mut PyCFunction_Type) PyObject_TypeCheck(op, &mut PyCFunction_Type)
} }
#[cfg(not(Py_3_9))]
#[inline]
pub unsafe fn PyCFunction_Check(op: *mut PyObject) -> c_int {
(Py_TYPE(op) == &mut PyCFunction_Type) as c_int
}
pub type PyCFunction = pub type PyCFunction =
unsafe extern "C" fn(slf: *mut PyObject, args: *mut PyObject) -> *mut PyObject; unsafe extern "C" fn(slf: *mut PyObject, args: *mut PyObject) -> *mut PyObject;