diff --git a/Misc/NEWS.d/next/C API/2023-08-28-17-58-46.gh-issue-85283.-4lp73.rst b/Misc/NEWS.d/next/C API/2023-08-28-17-58-46.gh-issue-85283.-4lp73.rst new file mode 100644 index 00000000000000..ae756295de27f7 --- /dev/null +++ b/Misc/NEWS.d/next/C API/2023-08-28-17-58-46.gh-issue-85283.-4lp73.rst @@ -0,0 +1,2 @@ +The ``_scproxy`` (macOS) C extension is now built with the :ref:`limited C API +`. Patch by Victor Stinner. diff --git a/Modules/_scproxy.c b/Modules/_scproxy.c index 0df0324df55f7d..16b70079fe6a87 100644 --- a/Modules/_scproxy.c +++ b/Modules/_scproxy.c @@ -2,6 +2,8 @@ * Helper method for urllib to fetch the proxy configuration settings * using the SystemConfiguration framework. */ +#define Py_LIMITED_API 0x030d0000 + #include #include @@ -84,7 +86,7 @@ get_proxy_settings(PyObject* Py_UNUSED(mod), PyObject *Py_UNUSED(ignored)) if (v == NULL) goto error; r = PyDict_SetItemString(result, "exclude_simple", v); - Py_SETREF(v, NULL); + Py_CLEAR(v); if (r == -1) goto error; anArray = CFDictionaryGetValue(proxyDict,