Skip to content

Commit ac8d90e

Browse files
committed
Module specifies Py_MOD_GIL_USED
1 parent d55b261 commit ac8d90e

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/lib.rs

+18-1
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,22 @@ pub unsafe extern "C" fn orjson_init_exec(mptr: *mut PyObject) -> c_int {
152152
0
153153
}
154154

155+
#[cfg(Py_3_13)]
156+
#[allow(non_upper_case_globals)]
157+
const Py_mod_gil: c_int = 4;
158+
#[cfg(Py_3_13)]
159+
#[allow(non_upper_case_globals, dead_code, fuzzy_provenance_casts)]
160+
const Py_MOD_GIL_USED: *mut c_void = 0 as *mut c_void;
161+
#[cfg(Py_3_13)]
162+
#[allow(non_upper_case_globals, dead_code, fuzzy_provenance_casts)]
163+
const Py_MOD_GIL_NOT_USED: *mut c_void = 1 as *mut c_void;
164+
155165
#[cfg(not(Py_3_12))]
156166
const PYMODULEDEF_LEN: usize = 2;
157-
#[cfg(Py_3_12)]
167+
#[cfg(all(Py_3_12, not(Py_3_13)))]
158168
const PYMODULEDEF_LEN: usize = 3;
169+
#[cfg(Py_3_13)]
170+
const PYMODULEDEF_LEN: usize = 4;
159171

160172
#[allow(non_snake_case)]
161173
#[no_mangle]
@@ -172,6 +184,11 @@ pub unsafe extern "C" fn PyInit_orjson() -> *mut PyModuleDef {
172184
slot: Py_mod_multiple_interpreters,
173185
value: Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED,
174186
},
187+
#[cfg(Py_3_13)]
188+
PyModuleDef_Slot {
189+
slot: Py_mod_gil,
190+
value: Py_MOD_GIL_USED,
191+
},
175192
PyModuleDef_Slot {
176193
slot: 0,
177194
value: null_mut(),

0 commit comments

Comments
 (0)