Skip to content

Commit dffccc6

Browse files
bpo-35452: Make PySys_HasWarnOptions() never raising an exception. (pythonGH-11075)
1 parent cf24735 commit dffccc6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Python/sysmodule.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,8 @@ int
18451845
PySys_HasWarnOptions(void)
18461846
{
18471847
PyObject *warnoptions = _PySys_GetObjectId(&PyId_warnoptions);
1848-
return (warnoptions != NULL && (PyList_Size(warnoptions) > 0)) ? 1 : 0;
1848+
return (warnoptions != NULL && PyList_Check(warnoptions)
1849+
&& PyList_GET_SIZE(warnoptions) > 0);
18491850
}
18501851

18511852
static PyObject *

0 commit comments

Comments
 (0)