From: Serhiy Storchaka Date: Mon, 10 Dec 2018 11:50:22 +0000 (+0200) Subject: bpo-35452: Make PySys_HasWarnOptions() never raising an exception. (GH-11075) X-Git-Tag: v3.8.0a1~304 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dffccc6b594951fc798973e521da205785823f0f;p=python bpo-35452: Make PySys_HasWarnOptions() never raising an exception. (GH-11075) --- diff --git a/Python/sysmodule.c b/Python/sysmodule.c index e6f1c4e8e9..029de2d5ae 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 *