diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-12-10 12:37:09 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-10 12:37:09 (GMT) |
| commit | ea773eb1f9e79e9f558ca1fe8909cf6ac1c00371 (patch) | |
| tree | 30dfab6f256b79e269a74acf681f57f5ebc9b01a /Python/sysmodule.c | |
| parent | 1467a3ac121897c2ad7512d664478d8916a35217 (diff) | |
| download | cpython-ea773eb1f9e79e9f558ca1fe8909cf6ac1c00371.zip cpython-ea773eb1f9e79e9f558ca1fe8909cf6ac1c00371.tar.gz cpython-ea773eb1f9e79e9f558ca1fe8909cf6ac1c00371.tar.bz2 | |
bpo-35452: Make PySys_HasWarnOptions() never raising an exception. (GH-11075)
(cherry picked from commit dffccc6b594951fc798973e521da205785823f0f)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Python/sysmodule.c')
| -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 a048507..efe5b29 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -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 * |
