diff Modules/arraymodule.c @ 22722:ba68dda15df0 legacy-trunk

Use the PyModule_*() API instead of manipulating the module dictionary directly.
author Fred Drake <fdrake@acm.org>
date Mon, 01 Apr 2002 03:45:06 +0000
parents edf05c69bbf3
children 72778ec94dec
line wrap: on
line diff
--- a/Modules/arraymodule.c	Mon Apr 01 01:41:20 2002 +0000
+++ b/Modules/arraymodule.c	Mon Apr 01 03:45:06 2002 +0000
@@ -1731,12 +1731,14 @@
 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 */
 }