diff options
author | Fred Drake <fdrake@acm.org> | 2002-04-01 03:45:06 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2002-04-01 03:45:06 (GMT) |
commit | f4e3484692096260e0ea030f4f3490204fb966c6 (patch) | |
tree | 2a225afe9b1e28343e1b4a87dc1f6982ef569b8c /Modules/arraymodule.c | |
parent | 7829335763ef520b909d657525f8a0a6e7b759db (diff) | |
download | cpython-f4e3484692096260e0ea030f4f3490204fb966c6.zip cpython-f4e3484692096260e0ea030f4f3490204fb966c6.tar.gz cpython-f4e3484692096260e0ea030f4f3490204fb966c6.tar.bz2 |
Use the PyModule_*() API instead of manipulating the module dictionary
directly.
Diffstat (limited to 'Modules/arraymodule.c')
-rw-r--r-- | Modules/arraymodule.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index 7372a48..46de178 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -1731,12 +1731,14 @@ static PyMethodDef a_methods[] = { DL_EXPORT(void) initarray(void) { - PyObject *m, *d; + PyObject *m; Arraytype.ob_type = &PyType_Type; m = Py_InitModule3("array", a_methods, module_doc); - d = PyModule_GetDict(m); - PyDict_SetItemString(d, "ArrayType", (PyObject *)&Arraytype); - PyDict_SetItemString(d, "array", (PyObject *)&Arraytype); + + Py_INCREF((PyObject *)&Arraytype); + PyModule_AddObject(m, "ArrayType", (PyObject *)&Arraytype); + Py_INCREF((PyObject *)&Arraytype); + PyModule_AddObject(m, "array", (PyObject *)&Arraytype); /* No need to check the error here, the caller will do that */ } |