Skip to content

Commit d7c050c

Browse files
authored
Fix missing return types in PyModExport API wrappers (#5764)
1 parent 45f9f62 commit d7c050c

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

pyo3-ffi/src/modsupport.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ pub const PyABIInfo_FREETHREADING_AGNOSTIC: u16 = PyABIInfo_GIL | PyABIInfo_FREE
172172

173173
#[cfg(Py_3_15)]
174174
extern "C" {
175-
pub fn PyABIInfo_Check(info: *mut PyABIInfo, module_name: *const c_char);
175+
pub fn PyABIInfo_Check(info: *mut PyABIInfo, module_name: *const c_char) -> c_int;
176176
}
177177

178178
#[cfg(all(Py_LIMITED_API, Py_3_15))]
@@ -209,6 +209,6 @@ pub const _PyABIInfo_DEFAULT: PyABIInfo = PyABIInfo {
209209
#[macro_export]
210210
macro_rules! PyABIInfo_VAR {
211211
($name:ident) => {
212-
static mut $name: PyABIInfo = _PyABIInfo_DEFAULT;
212+
static mut $name: pyo3_ffi::PyABIInfo = pyo3_ffi::_PyABIInfo_DEFAULT;
213213
};
214214
}

pyo3-ffi/src/moduleobject.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,13 @@ extern "C" {
142142

143143
#[cfg(Py_3_15)]
144144
extern "C" {
145-
pub fn PyModule_FromSlotsAndSpec(slots: *const PyModuleDef_Slot, spec: *mut PyObject);
146-
pub fn PyModule_Exec(_mod: *mut PyObject);
147-
pub fn PyModule_GetStateSize(_mod: *mut PyObject, result: *mut Py_ssize_t);
148-
pub fn PyModule_GetToken(module: *mut PyObject, result: *mut *mut c_void);
145+
pub fn PyModule_FromSlotsAndSpec(
146+
slots: *const PyModuleDef_Slot,
147+
spec: *mut PyObject,
148+
) -> *mut PyObject;
149+
pub fn PyModule_Exec(_mod: *mut PyObject) -> c_int;
150+
pub fn PyModule_GetStateSize(_mod: *mut PyObject, result: *mut Py_ssize_t) -> c_int;
151+
pub fn PyModule_GetToken(module: *mut PyObject, result: *mut *mut c_void) -> c_int;
149152
}
150153

151154
#[repr(C)]

pyo3-ffi/src/object.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,5 +742,6 @@ extern "C" {
742742
pub fn PyType_Freeze(tp: *mut crate::PyTypeObject) -> c_int;
743743

744744
#[cfg(Py_3_15)]
745-
pub fn PyType_GetModuleByToken(_type: *mut PyTypeObject, token: *const c_void);
745+
pub fn PyType_GetModuleByToken(_type: *mut PyTypeObject, token: *const c_void)
746+
-> *mut PyObject;
746747
}

0 commit comments

Comments
 (0)