diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2008-06-11 05:26:20 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2008-06-11 05:26:20 (GMT) |
commit | 1a21451b1d73b65af949193208372e86bf308411 (patch) | |
tree | 8e98d7be9e249b011ae9380479656e5284ec0234 /Modules/syslogmodule.c | |
parent | cdf94635d7e364f9ce1905bafa5b540f4d16147c (diff) | |
download | cpython-1a21451b1d73b65af949193208372e86bf308411.zip cpython-1a21451b1d73b65af949193208372e86bf308411.tar.gz cpython-1a21451b1d73b65af949193208372e86bf308411.tar.bz2 |
Implement PEP 3121: new module initialization and finalization API.
Diffstat (limited to 'Modules/syslogmodule.c')
-rw-r--r-- | Modules/syslogmodule.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/Modules/syslogmodule.c b/Modules/syslogmodule.c index 6f2a868..6c78679 100644 --- a/Modules/syslogmodule.c +++ b/Modules/syslogmodule.c @@ -163,15 +163,28 @@ static PyMethodDef syslog_methods[] = { /* Initialization function for the module */ + +static struct PyModuleDef syslogmodule = { + PyModuleDef_HEAD_INIT, + "syslog", + NULL, + -1, + syslog_methods, + NULL, + NULL, + NULL, + NULL +}; + PyMODINIT_FUNC -initsyslog(void) +PyInit_syslog(void) { PyObject *m; /* Create the module and add the functions */ - m = Py_InitModule("syslog", syslog_methods); + m = PyModule_Create(&syslogmodule); if (m == NULL) - return; + return NULL; /* Add some symbolic constants to the module */ @@ -229,4 +242,5 @@ initsyslog(void) PyModule_AddIntConstant(m, "LOG_CRON", LOG_CRON); PyModule_AddIntConstant(m, "LOG_UUCP", LOG_UUCP); PyModule_AddIntConstant(m, "LOG_NEWS", LOG_NEWS); + return m; } |