[pywin32-checkins] pywin32/win32/src win32helpmodule.cpp, 1.4.2.1, 1.4.2.2
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Roger U. <ru...@us...> - 2008-09-06 23:27:27
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13480 Modified Files: Tag: py3k win32helpmodule.cpp Log Message: Call PyType_Ready for types defined in module Add constants with unicode names Index: win32helpmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32helpmodule.cpp,v retrieving revision 1.4.2.1 retrieving revision 1.4.2.2 diff -C2 -d -r1.4.2.1 -r1.4.2.2 *** win32helpmodule.cpp 29 Aug 2008 04:59:26 -0000 1.4.2.1 --- win32helpmodule.cpp 6 Sep 2008 23:27:36 -0000 1.4.2.2 *************** *** 2633,2656 **** // Module constants: ! ! static int AddConstant(PyObject *dict, char *key, long value) ! { ! PyObject *okey = PyString_FromString(key); ! PyObject *oval = PyInt_FromLong(value); ! if (!okey || !oval) { ! Py_XDECREF(okey); ! Py_XDECREF(oval); ! return 1; ! } ! int rc = PyDict_SetItem(dict, okey, oval); ! Py_DECREF(okey); ! Py_DECREF(oval); ! return rc; ! } ! ! #define ADD_CONSTANT(tok) if (rc=AddConstant(dict,#tok, tok)) return rc ! ! int AddConstants(PyObject *dict) { int rc; --- 2633,2639 ---- // Module constants: + #define ADD_CONSTANT(tok) if (rc=PyModule_AddIntConstant(module, #tok, tok)) return rc ! int AddConstants(PyObject *module) { int rc; *************** *** 3250,3260 **** #if (PY_VERSION_HEX < 0x03000000) module = Py_InitModule("win32help", win32help_functions); - if (!module) - return; - dict = PyModule_GetDict(module); - if (!dict) - return; #else static PyModuleDef win32help_def = { PyModuleDef_HEAD_INIT, --- 3233,3240 ---- #if (PY_VERSION_HEX < 0x03000000) + #define RETURN_ERROR return; module = Py_InitModule("win32help", win32help_functions); #else + #define RETURN_ERROR return NULL; static PyModuleDef win32help_def = { PyModuleDef_HEAD_INIT, *************** *** 3265,3279 **** }; module = PyModule_Create(&win32help_def); if (!module) ! return NULL; dict = PyModule_GetDict(module); if (!dict) ! return NULL; ! #endif ! ! AddConstants(dict); ! PyDict_SetItemString(dict, "__version__", PyString_FromString("$Revision$")); #if (PY_VERSION_HEX >= 0x03000000) return module; --- 3245,3268 ---- }; module = PyModule_Create(&win32help_def); + #endif if (!module) ! RETURN_ERROR; dict = PyModule_GetDict(module); if (!dict) ! RETURN_ERROR; ! if (AddConstants(module) != 0) ! RETURN_ERROR; ! PyDict_SetItemString(dict, "__version__", PyString_FromString("$Revision$")); + if (PyType_Ready(&PyHH_AKLINKType) == -1 + ||PyType_Ready(&PyHH_FTS_QUERYType) == -1 + ||PyType_Ready(&PyHH_POPUPType) == -1 + ||PyType_Ready(&PyHH_WINTYPEType) == -1 + ||PyType_Ready(&PyNMHDRType) == -1 + ||PyType_Ready(&PyHHN_NOTIFYType) == -1 + ||PyType_Ready(&PyHHNTRACKType) == -1) + RETURN_ERROR; + #if (PY_VERSION_HEX >= 0x03000000) return module; |