diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-12-11 06:38:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-11 06:38:03 (GMT) |
commit | 8905fcc85a6fc3ac394bc89b0bbf40897e9497a6 (patch) | |
tree | 5b7afcdceab6dae37e3db90f952c5c76fe46b5cf /Python/_warnings.c | |
parent | bb86bf4c4eaa30b1f5192dab9f389ce0bb61114d (diff) | |
download | cpython-8905fcc85a6fc3ac394bc89b0bbf40897e9497a6.zip cpython-8905fcc85a6fc3ac394bc89b0bbf40897e9497a6.tar.gz cpython-8905fcc85a6fc3ac394bc89b0bbf40897e9497a6.tar.bz2 |
bpo-35454: Fix miscellaneous minor issues in error handling. (#11077)
* bpo-35454: Fix miscellaneous minor issues in error handling.
* Fix a null pointer dereference.
Diffstat (limited to 'Python/_warnings.c')
-rw-r--r-- | Python/_warnings.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c index ccbc73f..7eedd13 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -255,7 +255,11 @@ already_warned(PyObject *registry, PyObject *key, int should_set) version_obj = _PyDict_GetItemId(registry, &PyId_version); if (version_obj == NULL || !PyLong_CheckExact(version_obj) - || PyLong_AsLong(version_obj) != _PyRuntime.warnings.filters_version) { + || PyLong_AsLong(version_obj) != _PyRuntime.warnings.filters_version) + { + if (PyErr_Occurred()) { + return -1; + } PyDict_Clear(registry); version_obj = PyLong_FromLong(_PyRuntime.warnings.filters_version); if (version_obj == NULL) |