Mercurial > cpython-lru_cache-weakref
diff Modules/_bytesio.c @ 47580:94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Wed, 11 Jun 2008 05:26:20 +0000 |
| parents | 23ab586c427a |
| children | b2801aca9d6b |
line wrap: on
line diff
--- a/Modules/_bytesio.c Wed Jun 11 03:41:00 2008 +0000 +++ b/Modules/_bytesio.c Wed Jun 11 05:26:20 2008 +0000 @@ -722,16 +722,30 @@ 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; }
