256 PyMODINIT_FUNC initpyewf(
257 void )
258 {
259 PyObject* module = NULL;
260 PyTypeObject *type_object = NULL;
261
262 /* Create module
263 */
264 module = Py_InitModule3(
265 "pyewf",
when Py_InitModule4_64() fails
266 pyewf_module_methods,
267 "Python libewf module." );
268
269 /* Setup pyewf_file type
270 */
271 pyewf_type_object.tp_new = PyType_GenericNew;
272
273 if( PyType_Ready(
274 &pyewf_type_object ) < 0 )
when PyType_Ready() succeeds
taking False path
275 {
276 return;
277 }
278 Py_INCREF(
279 &pyewf_type_object );
280
281 type_object = &pyewf_type_object;
282
283 PyModule_AddObject(
284 module,
calling PyModule_AddObject with NULL as argument 1 (module) at pyewf.c:284
PyModule_AddObject() invokes Py_TYPE() on the pointer via the PyModule_Check() macro, thus accessing (NULL)->ob_type
285 "pyewf_file",
286 (PyObject *) type_object );
287
288 libewf_set_notify_values(
289 stderr,
290 1 );
291 }
292