From: Fred Drake Date: Wed, 3 Apr 2002 21:39:26 +0000 (+0000) Subject: Remove direct manipulation of the module dict. X-Git-Tag: v2.3c1~6157 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a2bd8d3816e35d1d678ba5b47a3666ab6e01f605;p=python Remove direct manipulation of the module dict. --- diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c index 20b53a7cc4..6dcd31a887 100644 --- a/Modules/unicodedata.c +++ b/Modules/unicodedata.c @@ -463,21 +463,15 @@ static char *unicodedata_docstring = "unicode character database"; DL_EXPORT(void) initunicodedata(void) { - PyObject *m, *d, *v; + PyObject *m, *v; m = Py_InitModule3( "unicodedata", unicodedata_functions, unicodedata_docstring); if (!m) return; - d = PyModule_GetDict(m); - if (!d) - return; - /* Export C API */ v = PyCObject_FromVoidPtr((void *) &hashAPI, NULL); - if (v != NULL) { - PyDict_SetItemString(d, "ucnhash_CAPI", v); - Py_DECREF(v); - } + if (v != NULL) + PyModule_AddObject(m, "ucnhash_CAPI", v); }