diff options
author | Fred Drake <fdrake@acm.org> | 2001-03-03 19:41:55 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2001-03-03 19:41:55 (GMT) |
commit | f585bef5043972b042cb324e75c82ee07fd56fa2 (patch) | |
tree | 105a38128fd789f31bff94f7162c69840af6de9e /Modules | |
parent | 6be838a0c0796f755c1ce94ce9772d1942e6fdf4 (diff) | |
download | cpython-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.c | 12 |
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); + } } |