Skip to content

Commit 75233bb

Browse files
committed
PYTHON-5033 Use PyModule_Add on >= 3.13
1 parent cf9b68c commit 75233bb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

bson/_cbsonmodule.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3227,11 +3227,19 @@ _cbson_exec(PyObject *m)
32273227
INITERROR;
32283228
}
32293229

3230+
#if PY_VERSION_HEX >= 0x030D0000
3231+
if (PyModule_Add(m, "_C_API", c_api_object) < 0) {
3232+
Py_DECREF(c_api_object);
3233+
Py_DECREF(m);
3234+
INITERROR;
3235+
}
3236+
# else
32303237
if (PyModule_AddObject(m, "_C_API", c_api_object) < 0) {
32313238
Py_DECREF(c_api_object);
32323239
Py_DECREF(m);
32333240
INITERROR;
32343241
}
3242+
#endif
32353243

32363244
return 0;
32373245
}

0 commit comments

Comments
 (0)