summaryrefslogtreecommitdiffstats
path: root/Modules/selectmodule.c
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2002-04-01 14:53:37 (GMT)
committerFred Drake <fdrake@acm.org>2002-04-01 14:53:37 (GMT)
commit4baedc1d9be6e5308d73439db54b58e51fb30dfc (patch)
treefb69c6411b2d7be1d2c09e0717329789ec8953ca /Modules/selectmodule.c
parent9bb7432114c97ad99c0813c1fef1ef4f1cda3361 (diff)
downloadcpython-4baedc1d9be6e5308d73439db54b58e51fb30dfc.zip
cpython-4baedc1d9be6e5308d73439db54b58e51fb30dfc.tar.gz
cpython-4baedc1d9be6e5308d73439db54b58e51fb30dfc.tar.bz2
Use the PyModule_Add*() APIs instead of manipulating the module dict
directly.
Diffstat (limited to 'Modules/selectmodule.c')
-rw-r--r--Modules/selectmodule.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 0a29f2e..03c222a 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -657,34 +657,35 @@ insint(PyObject *d, char *name, int value)
DL_EXPORT(void)
initselect(void)
{
- PyObject *m, *d;
+ PyObject *m;
m = Py_InitModule3("select", select_methods, module_doc);
- d = PyModule_GetDict(m);
+
SelectError = PyErr_NewException("select.error", NULL, NULL);
- PyDict_SetItemString(d, "error", SelectError);
+ Py_INCREF(SelectError);
+ PyModule_AddObject(m, "error", SelectError);
#ifdef HAVE_POLL
poll_Type.ob_type = &PyType_Type;
- insint(d, "POLLIN", POLLIN);
- insint(d, "POLLPRI", POLLPRI);
- insint(d, "POLLOUT", POLLOUT);
- insint(d, "POLLERR", POLLERR);
- insint(d, "POLLHUP", POLLHUP);
- insint(d, "POLLNVAL", POLLNVAL);
+ PyModule_AddIntConstant(m, "POLLIN", POLLIN);
+ PyModule_AddIntConstant(m, "POLLPRI", POLLPRI);
+ PyModule_AddIntConstant(m, "POLLOUT", POLLOUT);
+ PyModule_AddIntConstant(m, "POLLERR", POLLERR);
+ PyModule_AddIntConstant(m, "POLLHUP", POLLHUP);
+ PyModule_AddIntConstant(m, "POLLNVAL", POLLNVAL);
#ifdef POLLRDNORM
- insint(d, "POLLRDNORM", POLLRDNORM);
+ PyModule_AddIntConstant(m, "POLLRDNORM", POLLRDNORM);
#endif
#ifdef POLLRDBAND
- insint(d, "POLLRDBAND", POLLRDBAND);
+ PyModule_AddIntConstant(m, "POLLRDBAND", POLLRDBAND);
#endif
#ifdef POLLWRNORM
- insint(d, "POLLWRNORM", POLLWRNORM);
+ PyModule_AddIntConstant(m, "POLLWRNORM", POLLWRNORM);
#endif
#ifdef POLLWRBAND
- insint(d, "POLLWRBAND", POLLWRBAND);
+ PyModule_AddIntConstant(m, "POLLWRBAND", POLLWRBAND);
#endif
#ifdef POLLMSG
- insint(d, "POLLMSG", POLLMSG);
+ PyModule_AddIntConstant(m, "POLLMSG", POLLMSG);
#endif
#endif /* HAVE_POLL */
}