From f585bef5043972b042cb324e75c82ee07fd56fa2 Mon Sep 17 00:00:00 2001 From: Fred Drake Date: Sat, 3 Mar 2001 19:41:55 +0000 Subject: [PATCH] Be a bit more strict in setting up the export of the C API for this module; do not attempt to insert the API object into the module dict if there was an error creating it. --- Modules/unicodedata.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c index 56c9466dbb..69345ea32b 100644 --- a/Modules/unicodedata.c +++ b/Modules/unicodedata.c @@ -463,9 +463,8 @@ initunicodedata(void) { PyObject *m, *d, *v; - m = Py_InitModule4( - "unicodedata", unicodedata_functions, - unicodedata_docstring, NULL, PYTHON_API_VERSION); + m = Py_InitModule3( + "unicodedata", unicodedata_functions, unicodedata_docstring); if (!m) return; @@ -475,7 +474,8 @@ initunicodedata(void) /* Export C API */ v = PyCObject_FromVoidPtr((void *) &hashAPI, NULL); - PyDict_SetItemString(d, "ucnhash_CAPI", v); - Py_XDECREF(v); - + if (v != NULL) { + PyDict_SetItemString(d, "ucnhash_CAPI", v); + Py_DECREF(v); + } } -- 2.50.0