summaryrefslogtreecommitdiffstats
path: root/Modules/_localemodule.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2008-06-11 05:26:20 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2008-06-11 05:26:20 (GMT)
commit1a21451b1d73b65af949193208372e86bf308411 (patch)
tree8e98d7be9e249b011ae9380479656e5284ec0234 /Modules/_localemodule.c
parentcdf94635d7e364f9ce1905bafa5b540f4d16147c (diff)
downloadcpython-1a21451b1d73b65af949193208372e86bf308411.zip
cpython-1a21451b1d73b65af949193208372e86bf308411.tar.gz
cpython-1a21451b1d73b65af949193208372e86bf308411.tar.bz2
Implement PEP 3121: new module initialization and finalization API.
Diffstat (limited to 'Modules/_localemodule.c')
-rw-r--r--Modules/_localemodule.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
index af36a59..50c72c9 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -657,17 +657,30 @@ static struct PyMethodDef PyLocale_Methods[] = {
{NULL, NULL}
};
+
+static struct PyModuleDef _localemodule = {
+ PyModuleDef_HEAD_INIT,
+ "_locale",
+ locale__doc__,
+ -1,
+ PyLocale_Methods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
+};
+
PyMODINIT_FUNC
-init_locale(void)
+PyInit__locale(void)
{
PyObject *m, *d, *x;
#ifdef HAVE_LANGINFO_H
int i;
#endif
- m = Py_InitModule3("_locale", PyLocale_Methods, locale__doc__);
+ m = PyModule_Create(&_localemodule);
if (m == NULL)
- return;
+ return NULL;
d = PyModule_GetDict(m);
@@ -714,6 +727,7 @@ init_locale(void)
langinfo_constants[i].value);
}
#endif
+ return m;
}
/*