diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-12-10 11:50:22 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-10 11:50:22 (GMT) |
commit | dffccc6b594951fc798973e521da205785823f0f (patch) | |
tree | 169c775d3760120f871b21f0412b3a84c58c8640 /Python | |
parent | cf247359d5b7082044eea1fa94b5211a172b1ff6 (diff) | |
download | cpython-dffccc6b594951fc798973e521da205785823f0f.zip cpython-dffccc6b594951fc798973e521da205785823f0f.tar.gz cpython-dffccc6b594951fc798973e521da205785823f0f.tar.bz2 |
bpo-35452: Make PySys_HasWarnOptions() never raising an exception. (GH-11075)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/sysmodule.c | 3 |
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 * |