Kaydet (Commit) 8972dfd5 authored tarafından Fred Drake's avatar Fred Drake

For ZlibError and ZLIB_VERSION, only attempt to add entry to the

module dict if the inserted object isn't NULL (basic defensive
programming!).
üst 96a8fb7e
...@@ -870,7 +870,8 @@ PyInit_zlib() ...@@ -870,7 +870,8 @@ PyInit_zlib()
(PyObject*)NULL,PYTHON_API_VERSION); (PyObject*)NULL,PYTHON_API_VERSION);
d = PyModule_GetDict(m); d = PyModule_GetDict(m);
ZlibError = PyErr_NewException("zlib.error", NULL, NULL); ZlibError = PyErr_NewException("zlib.error", NULL, NULL);
PyDict_SetItemString(d, "error", ZlibError); if (ZlibError != NULL)
PyDict_SetItemString(d, "error", ZlibError);
insint(d, "MAX_WBITS", MAX_WBITS); insint(d, "MAX_WBITS", MAX_WBITS);
insint(d, "DEFLATED", DEFLATED); insint(d, "DEFLATED", DEFLATED);
...@@ -888,6 +889,8 @@ PyInit_zlib() ...@@ -888,6 +889,8 @@ PyInit_zlib()
insint(d, "Z_FULL_FLUSH", Z_FULL_FLUSH); insint(d, "Z_FULL_FLUSH", Z_FULL_FLUSH);
ver = PyString_FromString(ZLIB_VERSION); ver = PyString_FromString(ZLIB_VERSION);
PyDict_SetItemString(d, "ZLIB_VERSION", ver); if (ver != NULL) {
Py_DECREF(ver); PyDict_SetItemString(d, "ZLIB_VERSION", ver);
Py_DECREF(ver);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment