https://github.com/python/cpython/commit/6044c6275dcfcb2f2fc49742920e4cfb094089a4
commit: 6044c6275dcfcb2f2fc49742920e4cfb094089a4
branch: main
author: Jelle Zijlstra <[email protected]>
committer: JelleZijlstra <[email protected]>
date: 2026-10-19T19:31:36-07:00
summary:

gh-159739: Propagate macOS proxy conversion errors (#159750)

Propagate Python exceptions from Core Foundation string conversion
instead of returning a result with an exception set.

files:
A Misc/NEWS.d/next/macOS/2026-10-19-19-33-35.gh-issue-159739.aaf575.rst
M Modules/_scproxy.c

diff --git 
a/Misc/NEWS.d/next/macOS/2026-10-19-19-33-35.gh-issue-159739.aaf575.rst 
b/Misc/NEWS.d/next/macOS/2026-10-19-19-33-35.gh-issue-159739.aaf575.rst
new file mode 100644
index 000000000000000..0e29daaa307e221
--- /dev/null
+++ b/Misc/NEWS.d/next/macOS/2026-10-19-19-33-35.gh-issue-159739.aaf575.rst
@@ -0,0 +1 @@
+Propagate errors that occur while converting macOS system proxy settings.
diff --git a/Modules/_scproxy.c b/Modules/_scproxy.c
index e9170f2ce1ae872..94163197a3a2e3a 100644
--- a/Modules/_scproxy.c
+++ b/Modules/_scproxy.c
@@ -113,6 +113,7 @@ get_proxy_settings(PyObject* Py_UNUSED(mod), PyObject 
*Py_UNUSED(ignored))
             } else {
                 PyObject* t = cfstring_to_pystring(aString);
                 if (!t) {
+                    if (PyErr_Occurred()) goto error;
                     PyTuple_SetItem(v, i, Py_NewRef(Py_None));
                 } else {
                     PyTuple_SetItem(v, i, t);
@@ -161,6 +162,7 @@ set_proxy(PyObject* proxies, const char* proto, 
CFDictionaryRef proxyDict,
                 Py_DECREF(v);
                 return r;
             }
+            if (PyErr_Occurred()) return -1;
         }
 
     }

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to