From 23dcbabf5b1aae3da4b92363b75e685feb19642b Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Mon, 16 Sep 2024 09:37:54 +0900 Subject: [PATCH] Use v3.12 API in stable ABI builds --- src/common.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common.cpp b/src/common.cpp index b3d4d02d..02bc02ad 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -184,7 +184,7 @@ PyObject *module_new_submodule(PyObject *base, const char *name, if (!tmp_str) goto fail; -#if PY_VERSION_HEX < 0x030D00A0 +#if PY_VERSION_HEX < 0x030D00A0 || defined(Py_LIMITED_API) res = borrow(PyImport_AddModule(tmp_str)); #else res = steal(PyImport_AddModuleRef(tmp_str)); @@ -1188,7 +1188,8 @@ void maybe_make_immortal(PyObject *op) { PyObject *dict_get_item_ref_or_fail(PyObject *d, PyObject *k) { PyObject *value; bool error = false; -#if PY_VERSION_HEX < 0x030D00A1 + +#if PY_VERSION_HEX < 0x030D00A1 || defined(Py_LIMITED_API) value = PyDict_GetItemWithError(d, k); if (value) Py_INCREF(value);