[pywin32-checkins] pywin32/com/win32comext/propsys/src propsys.cpp, 1.1, 1.1.2.1
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Roger U. <ru...@us...> - 2008-09-17 08:40:46
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/propsys/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6852 Modified Files: Tag: py3k propsys.cpp Log Message: Convert module init for Py3k Index: propsys.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/propsys/src/propsys.cpp,v retrieving revision 1.1 retrieving revision 1.1.2.1 diff -C2 -d -r1.1 -r1.1.2.1 *** propsys.cpp 22 Jan 2008 12:22:14 -0000 1.1 --- propsys.cpp 17 Sep 2008 08:40:55 -0000 1.1.2.1 *************** *** 60,64 **** /* List of module functions */ ! // @module propsys|A module, encapsulating the Vista propsys interfaces static struct PyMethodDef propsys_methods[]= { --- 60,64 ---- /* List of module functions */ ! // @module propsys|A module, encapsulating the Vista Property System interfaces static struct PyMethodDef propsys_methods[]= { *************** *** 74,90 **** /* Module initialisation */ ! extern "C" __declspec(dllexport) void initpropsys() { ! char *modName = "propsys"; ! PyObject *oModule; ! // Create the module and add the functions ! oModule = Py_InitModule(modName, propsys_methods); ! if (!oModule) /* Eeek - some serious error! */ ! return; ! PyObject *dict = PyModule_GetDict(oModule); ! if (!dict) return; /* Another serious error!*/ - PyDict_SetItemString(dict, "error", PyWinExc_COMError); // Register all of our interfaces, gateways and IIDs. //PyCom_RegisterExtensionSupport(dict, g_interfaceSupportData, sizeof(g_interfaceSupportData)/sizeof(PyCom_InterfaceSupportInfo)); } --- 74,116 ---- /* Module initialisation */ ! extern "C" __declspec(dllexport) ! #if (PY_VERSION_HEX < 0x03000000) ! void initpropsys(void) ! #else ! PyObject *PyInit_propsys(void) ! #endif { ! PyObject *dict, *module; ! ! #if (PY_VERSION_HEX < 0x03000000) ! #define RETURN_ERROR return; ! module = Py_InitModule("propsys", propsys_methods); ! ! #else ! #define RETURN_ERROR return NULL; ! static PyModuleDef propsys_def = { ! PyModuleDef_HEAD_INIT, ! "propsys", ! "A module, encapsulating the Vista Property System interfaces", ! -1, ! propsys_methods ! }; ! module = PyModule_Create(&propsys_def); ! #endif ! ! if (!module) ! RETURN_ERROR; ! dict = PyModule_GetDict(module); ! if (!dict) ! RETURN_ERROR; ! ! if (PyDict_SetItemString(dict, "error", PyWinExc_COMError) == -1) ! RETURN_ERROR; // Register all of our interfaces, gateways and IIDs. //PyCom_RegisterExtensionSupport(dict, g_interfaceSupportData, sizeof(g_interfaceSupportData)/sizeof(PyCom_InterfaceSupportInfo)); + + #if (PY_VERSION_HEX >= 0x03000000) + return module; + #endif } |