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/_bytesio.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/_bytesio.c')
-rw-r--r-- | Modules/_bytesio.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/Modules/_bytesio.c b/Modules/_bytesio.c index 455f9b1..d7d2667 100644 --- a/Modules/_bytesio.c +++ b/Modules/_bytesio.c @@ -722,16 +722,30 @@ static PyTypeObject BytesIO_Type = { bytesio_new, /*tp_new*/ }; + +static struct PyModuleDef _bytesiomodule = { + PyModuleDef_HEAD_INIT, + "_bytesio", + NULL, + -1, + NULL, + NULL, + NULL, + NULL, + NULL +}; + PyMODINIT_FUNC -init_bytesio(void) +PyInit__bytesio(void) { PyObject *m; if (PyType_Ready(&BytesIO_Type) < 0) - return; - m = Py_InitModule("_bytesio", NULL); + return NULL; + m = PyModule_Create(&_bytesiomodule); if (m == NULL) - return; + return NULL; Py_INCREF(&BytesIO_Type); PyModule_AddObject(m, "_BytesIO", (PyObject *)&BytesIO_Type); + return m; } |