summaryrefslogtreecommitdiff
path: root/Modules/selectmodule.c
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2002-04-01 14:53:37 +0000
committerFred Drake <fdrake@acm.org>2002-04-01 14:53:37 +0000
commit97ffab1f749106f70938e3fce23be468b5e4bbec (patch)
tree09824050579840dd8adb7e3cc9b3ecd121d57a4a /Modules/selectmodule.c
parentdf7f433fffa11ed648bb122576dd9f066f0b2341 (diff)
downloadcpython-97ffab1f749106f70938e3fce23be468b5e4bbec.tar.gz
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 0a29f2efd5..03c222ad47 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 */
}