Skip to content

Commit 6044c62

Browse files
authored
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.
1 parent 9c239fb commit 6044c62

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Propagate errors that occur while converting macOS system proxy settings.

‎Modules/_scproxy.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ get_proxy_settings(PyObject* Py_UNUSED(mod), PyObject *Py_UNUSED(ignored))
113113
} else {
114114
PyObject* t = cfstring_to_pystring(aString);
115115
if (!t) {
116+
if (PyErr_Occurred()) goto error;
116117
PyTuple_SetItem(v, i, Py_NewRef(Py_None));
117118
} else {
118119
PyTuple_SetItem(v, i, t);
@@ -161,6 +162,7 @@ set_proxy(PyObject* proxies, const char* proto, CFDictionaryRef proxyDict,
161162
Py_DECREF(v);
162163
return r;
163164
}
165+
if (PyErr_Occurred()) return -1;
164166
}
165167

166168
}

0 commit comments

Comments
 (0)