init_subprocess() { PyObject *d; PyObject *m; /* patch up object descriptors */ sp_handle_type.ob_type = &PyType_Type; sp_handle_as_number.nb_int = (unaryfunc) sp_handle_as_int; m = Py_InitModule("_subprocess", sp_functions); if (m == NULL) return; d = PyModule_GetDict(m); /* constants */ defint(d, "STD_INPUT_HANDLE", STD_INPUT_HANDLE); defint(d, "STD_OUTPUT_HANDLE", STD_OUTPUT_HANDLE); defint(d, "STD_ERROR_HANDLE", STD_ERROR_HANDLE); defint(d, "DUPLICATE_SAME_ACCESS", DUPLICATE_SAME_ACCESS); defint(d, "STARTF_USESTDHANDLES", STARTF_USESTDHANDLES); defint(d, "STARTF_USESHOWWINDOW", STARTF_USESHOWWINDOW); defint(d, "SW_HIDE", SW_HIDE); defint(d, "INFINITE", INFINITE); defint(d, "WAIT_OBJECT_0", WAIT_OBJECT_0); defint(d, "CREATE_NEW_CONSOLE", CREATE_NEW_CONSOLE); }
PyMODINIT_FUNC PyInit__subprocess() { PyObject *d; PyObject *m; /* patch up object descriptors */ sp_handle_as_number.nb_int = (unaryfunc) sp_handle_as_int; if (PyType_Ready(&sp_handle_type) < 0) return NULL; m = PyModule_Create(&_subprocessmodule); if (m == NULL) return NULL; d = PyModule_GetDict(m); /* constants */ defint(d, "STD_INPUT_HANDLE", STD_INPUT_HANDLE); defint(d, "STD_OUTPUT_HANDLE", STD_OUTPUT_HANDLE); defint(d, "STD_ERROR_HANDLE", STD_ERROR_HANDLE); defint(d, "DUPLICATE_SAME_ACCESS", DUPLICATE_SAME_ACCESS); defint(d, "STARTF_USESTDHANDLES", STARTF_USESTDHANDLES); defint(d, "STARTF_USESHOWWINDOW", STARTF_USESHOWWINDOW); defint(d, "SW_HIDE", SW_HIDE); defint(d, "INFINITE", INFINITE); defint(d, "WAIT_OBJECT_0", WAIT_OBJECT_0); defint(d, "CREATE_NEW_CONSOLE", CREATE_NEW_CONSOLE); defint(d, "CREATE_NEW_PROCESS_GROUP", CREATE_NEW_PROCESS_GROUP); defint(d, "STILL_ACTIVE", STILL_ACTIVE); return m; }