bpo-35452: Make PySys_HasWarnOptions() never raising an exception. (GH-11075)

(cherry picked from commit dffccc6b59)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
Miss Islington (bot) 2018-12-10 04:37:09 -08:00 committed by GitHub
parent 1467a3ac12
commit ea773eb1f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -1823,7 +1823,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 *