mirror of
https://github.com/python/cpython.git
synced 2026-01-06 07:22:09 +00:00
Use the PyModule_*() API instead of manipulating the module dictionary
directly.
This commit is contained in:
parent
7829335763
commit
f4e3484692
2 changed files with 11 additions and 11 deletions
|
|
@ -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 */
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue