summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Include/sysmodule.h5
-rw-r--r--Python/sysmodule.c11
2 files changed, 8 insertions, 8 deletions
diff --git a/Include/sysmodule.h b/Include/sysmodule.h
index 719ecfc..c5547ff 100644
--- a/Include/sysmodule.h
+++ b/Include/sysmodule.h
@@ -37,11 +37,6 @@ PyAPI_FUNC(PyObject *) PySys_GetXOptions(void);
PyAPI_FUNC(size_t) _PySys_GetSizeOf(PyObject *);
#endif
-#ifdef Py_BUILD_CORE
-PyAPI_FUNC(int) _PySys_AddXOptionWithError(const wchar_t *s);
-PyAPI_FUNC(int) _PySys_AddWarnOptionWithError(PyObject *option);
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index f88b273..9579eae 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1807,7 +1807,7 @@ PySys_ResetWarnOptions(void)
PyList_SetSlice(warnoptions, 0, PyList_GET_SIZE(warnoptions), NULL);
}
-int
+static int
_PySys_AddWarnOptionWithError(PyObject *option)
{
PyObject *warnoptions = get_warnoptions();
@@ -1823,7 +1823,12 @@ _PySys_AddWarnOptionWithError(PyObject *option)
void
PySys_AddWarnOptionUnicode(PyObject *option)
{
- (void)_PySys_AddWarnOptionWithError(option);
+ if (_PySys_AddWarnOptionWithError(option) < 0) {
+ /* No return value, therefore clear error state if possible */
+ if (_PyThreadState_UncheckedGet()) {
+ PyErr_Clear();
+ }
+ }
}
void
@@ -1877,7 +1882,7 @@ get_xoptions(void)
return xoptions;
}
-int
+static int
_PySys_AddXOptionWithError(const wchar_t *s)
{
PyObject *name = NULL, *value = NULL;