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

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.
üst 6be838a0
...@@ -463,9 +463,8 @@ initunicodedata(void) ...@@ -463,9 +463,8 @@ initunicodedata(void)
{ {
PyObject *m, *d, *v; PyObject *m, *d, *v;
m = Py_InitModule4( m = Py_InitModule3(
"unicodedata", unicodedata_functions, "unicodedata", unicodedata_functions, unicodedata_docstring);
unicodedata_docstring, NULL, PYTHON_API_VERSION);
if (!m) if (!m)
return; return;
...@@ -475,7 +474,8 @@ initunicodedata(void) ...@@ -475,7 +474,8 @@ initunicodedata(void)
/* Export C API */ /* Export C API */
v = PyCObject_FromVoidPtr((void *) &hashAPI, NULL); v = PyCObject_FromVoidPtr((void *) &hashAPI, NULL);
PyDict_SetItemString(d, "ucnhash_CAPI", v); if (v != NULL) {
Py_XDECREF(v); PyDict_SetItemString(d, "ucnhash_CAPI", v);
Py_DECREF(v);
}
} }
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