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/cjkcodecs/cjkcodecs.h | |
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/cjkcodecs/cjkcodecs.h')
-rw-r--r-- | Modules/cjkcodecs/cjkcodecs.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Modules/cjkcodecs/cjkcodecs.h b/Modules/cjkcodecs/cjkcodecs.h index fb6b5ce..89c644c 100644 --- a/Modules/cjkcodecs/cjkcodecs.h +++ b/Modules/cjkcodecs/cjkcodecs.h @@ -389,12 +389,24 @@ errorexit: #endif #define I_AM_A_MODULE_FOR(loc) \ - void \ - init_codecs_##loc(void) \ + static struct PyModuleDef __module = { \ + PyModuleDef_HEAD_INIT, \ + "_codecs_"#loc, \ + NULL, \ + 0, \ + __methods, \ + NULL, \ + NULL, \ + NULL, \ + NULL \ + }; \ + PyObject* \ + PyInit__codecs_##loc(void) \ { \ - PyObject *m = Py_InitModule("_codecs_" #loc, __methods);\ + PyObject *m = PyModule_Create(&__module); \ if (m != NULL) \ (void)register_maps(m); \ + return m; \ } #endif |