summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Python/sysmodule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index e6f1c4e..029de2d 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1845,7 +1845,8 @@ int
PySys_HasWarnOptions(void)
{
PyObject *warnoptions = _PySys_GetObjectId(&PyId_warnoptions);
- return (warnoptions != NULL && (PyList_Size(warnoptions) > 0)) ? 1 : 0;
+ return (warnoptions != NULL && PyList_Check(warnoptions)
+ && PyList_GET_SIZE(warnoptions) > 0);
}
static PyObject *