summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2002-04-03 21:39:26 (GMT)
committerFred Drake <fdrake@acm.org>2002-04-03 21:39:26 (GMT)
commita2bd8d3816e35d1d678ba5b47a3666ab6e01f605 (patch)
tree5d66e3b1662fb7837e2d1fc22792011832b150f0
parent8f3078b3f0d7379932b8055eb7f7f4076c90f11b (diff)
downloadcpython-a2bd8d3816e35d1d678ba5b47a3666ab6e01f605.zip
cpython-a2bd8d3816e35d1d678ba5b47a3666ab6e01f605.tar.gz
cpython-a2bd8d3816e35d1d678ba5b47a3666ab6e01f605.tar.bz2
Remove direct manipulation of the module dict.
-rw-r--r--Modules/unicodedata.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c
index 20b53a7..6dcd31a 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);
}