summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-03-03 19:41:55 (GMT)
committerFred Drake <fdrake@acm.org>2001-03-03 19:41:55 (GMT)
commitf585bef5043972b042cb324e75c82ee07fd56fa2 (patch)
tree105a38128fd789f31bff94f7162c69840af6de9e /Modules
parent6be838a0c0796f755c1ce94ce9772d1942e6fdf4 (diff)
downloadcpython-f585bef5043972b042cb324e75c82ee07fd56fa2.zip
cpython-f585bef5043972b042cb324e75c82ee07fd56fa2.tar.gz
cpython-f585bef5043972b042cb324e75c82ee07fd56fa2.tar.bz2
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.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/unicodedata.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c
index 56c9466..69345ea 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);
+ }
}