Update of /cvsroot/pywin32/pywin32/win32/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15887/win32/src
Modified Files:
Tag: py3k
PyWinTypes.h PyWinTypesmodule.cpp mmapfilemodule.cpp odbc.cpp
timermodule.cpp win2krasmodule.cpp win32apimodule.cpp
win32clipboardmodule.cpp win32consolemodule.cpp
win32credmodule.cpp win32helpmodule.cpp win32lzmodule.cpp
win32pdhmodule.cpp win32rasmodule.cpp win32trace.cpp
win32transactionmodule.cpp win32tsmodule.cpp
Log Message:
merge recent PYWIN_MODULE* changes from trunk
Index: odbc.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/odbc.cpp,v
retrieving revision 1.20.2.12
retrieving revision 1.20.2.13
diff -C2 -d -r1.20.2.12 -r1.20.2.13
*** odbc.cpp 6 Dec 2008 01:47:36 -0000 1.20.2.12
--- odbc.cpp 8 Dec 2008 13:41:06 -0000 1.20.2.13
***************
*** 2002,2038 ****
! #define ADD_CONSTANT(tok) if (PyModule_AddIntConstant(module, #tok, tok) == -1) RETURN_ERROR;
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initodbc(void)
! #else
! PyObject *PyInit_odbc(void)
! #endif
{
! PyObject *dict, *module;
! PyWinGlobals_Ensure();
!
! #if (PY_VERSION_HEX < 0x03000000)
! #define RETURN_ERROR return;
! module = Py_InitModule("odbc", globalMethods);
!
! #else
! #define RETURN_ERROR return NULL;
! static PyModuleDef odbc_def = {
! PyModuleDef_HEAD_INIT,
! "odbc",
! "A Python wrapper around the ODBC API.",
! -1,
! globalMethods
! };
! module = PyModule_Create(&odbc_def);
! #endif
!
! if (!module)
! RETURN_ERROR;
! dict = PyModule_GetDict(module);
! if (!dict)
! RETURN_ERROR;
// Sql dates are now returned as python's datetime object.
--- 2002,2011 ----
! #define ADD_CONSTANT(tok) if (PyModule_AddIntConstant(module, #tok, tok) == -1) PYWIN_MODULE_INIT_RETURN_ERROR;
! PYWIN_MODULE_INIT_FUNC(odbc)
{
! PYWIN_MODULE_INIT_PREPARE(odbc, globalMethods,
! "A Python wrapper around the ODBC API.");
// Sql dates are now returned as python's datetime object.
***************
*** 2040,2052 ****
datetime_module=PyImport_ImportModule("datetime");
if (datetime_module == NULL)
! RETURN_ERROR;
datetime_class = PyObject_GetAttrString(datetime_module, "datetime");
if (datetime_class == NULL)
! RETURN_ERROR;
if (unsuccessful(SQLAllocEnv(&Env)))
{
odbcPrintError(SQL_NULL_HENV, 0, SQL_NULL_HSTMT, _T("INIT"));
! RETURN_ERROR;
}
--- 2013,2025 ----
datetime_module=PyImport_ImportModule("datetime");
if (datetime_module == NULL)
! PYWIN_MODULE_INIT_RETURN_ERROR;
datetime_class = PyObject_GetAttrString(datetime_module, "datetime");
if (datetime_class == NULL)
! PYWIN_MODULE_INIT_RETURN_ERROR;
if (unsuccessful(SQLAllocEnv(&Env)))
{
odbcPrintError(SQL_NULL_HENV, 0, SQL_NULL_HSTMT, _T("INIT"));
! PYWIN_MODULE_INIT_RETURN_ERROR;
}
***************
*** 2065,2069 ****
// Steals a ref to obtypes, so it doesn't need to be DECREF'ed.
if (obtypes==NULL || PyModule_AddObject(module, "TYPES", obtypes) == -1)
! RETURN_ERROR;
DbiString = PyTuple_GET_ITEM(obtypes, 0);
DbiRaw = PyTuple_GET_ITEM(obtypes, 1);
--- 2038,2042 ----
// Steals a ref to obtypes, so it doesn't need to be DECREF'ed.
if (obtypes==NULL || PyModule_AddObject(module, "TYPES", obtypes) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
DbiString = PyTuple_GET_ITEM(obtypes, 0);
DbiRaw = PyTuple_GET_ITEM(obtypes, 1);
***************
*** 2077,2104 ****
||PyDict_SetItem(dict, DbiNumber, DbiNumber) == -1
||PyDict_SetItem(dict, DbiDate, DbiDate) == -1)
! RETURN_ERROR;
// Initialize various exception types
odbcError = PyErr_NewException("odbc.odbcError", NULL, NULL);
if (odbcError == NULL || PyDict_SetItemString(dict, "error", odbcError) == -1)
! RETURN_ERROR;
DbiNoError = PyErr_NewException("dbi.noError", NULL, NULL);
if (DbiNoError == NULL || PyDict_SetItemString(dict, "noError", DbiNoError) == -1)
! RETURN_ERROR;
DbiOpError = PyErr_NewException("dbi.opError", NULL, NULL);
if (DbiOpError == NULL || PyDict_SetItemString(dict, "opError", DbiOpError) == -1)
! RETURN_ERROR;
DbiProgError = PyErr_NewException("dbi.progError", NULL, NULL);
if (DbiProgError == NULL || PyDict_SetItemString(dict, "progError", DbiProgError) == -1)
! RETURN_ERROR;
DbiIntegrityError = PyErr_NewException("dbi.integrityError", NULL, NULL);
if (DbiIntegrityError == NULL || PyDict_SetItemString(dict, "integrityError", DbiIntegrityError) == -1)
! RETURN_ERROR;
DbiDataError = PyErr_NewException("dbi.dataError", NULL, NULL);
if (DbiDataError == NULL || PyDict_SetItemString(dict, "dataError", DbiDataError) == -1)
! RETURN_ERROR;
DbiInternalError = PyErr_NewException("dbi.internalError", NULL, NULL);
if (DbiInternalError == NULL || PyDict_SetItemString(dict, "internalError", DbiInternalError) == -1)
! RETURN_ERROR;
/* The indices go to indices in the ODBC error table */
dbiErrors[0] = DbiNoError;
--- 2050,2077 ----
||PyDict_SetItem(dict, DbiNumber, DbiNumber) == -1
||PyDict_SetItem(dict, DbiDate, DbiDate) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
// Initialize various exception types
odbcError = PyErr_NewException("odbc.odbcError", NULL, NULL);
if (odbcError == NULL || PyDict_SetItemString(dict, "error", odbcError) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
DbiNoError = PyErr_NewException("dbi.noError", NULL, NULL);
if (DbiNoError == NULL || PyDict_SetItemString(dict, "noError", DbiNoError) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
DbiOpError = PyErr_NewException("dbi.opError", NULL, NULL);
if (DbiOpError == NULL || PyDict_SetItemString(dict, "opError", DbiOpError) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
DbiProgError = PyErr_NewException("dbi.progError", NULL, NULL);
if (DbiProgError == NULL || PyDict_SetItemString(dict, "progError", DbiProgError) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
DbiIntegrityError = PyErr_NewException("dbi.integrityError", NULL, NULL);
if (DbiIntegrityError == NULL || PyDict_SetItemString(dict, "integrityError", DbiIntegrityError) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
DbiDataError = PyErr_NewException("dbi.dataError", NULL, NULL);
if (DbiDataError == NULL || PyDict_SetItemString(dict, "dataError", DbiDataError) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
DbiInternalError = PyErr_NewException("dbi.internalError", NULL, NULL);
if (DbiInternalError == NULL || PyDict_SetItemString(dict, "internalError", DbiInternalError) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
/* The indices go to indices in the ODBC error table */
dbiErrors[0] = DbiNoError;
***************
*** 2118,2124 ****
ADD_CONSTANT(SQL_FETCH_FIRST_SYSTEM);
! #if (PY_VERSION_HEX >= 0x03000000)
! return module;
! #endif
}
--- 2091,2095 ----
ADD_CONSTANT(SQL_FETCH_FIRST_SYSTEM);
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: win32rasmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32rasmodule.cpp,v
retrieving revision 1.10.2.3
retrieving revision 1.10.2.4
diff -C2 -d -r1.10.2.3 -r1.10.2.4
*** win32rasmodule.cpp 4 Dec 2008 00:07:22 -0000 1.10.2.3
--- win32rasmodule.cpp 8 Dec 2008 13:41:06 -0000 1.10.2.4
***************
*** 826,830 ****
static int AddConstants(PyObject *module)
{
! int rc;
ADD_CONSTANT(RASCS_OpenPort); // @const win32ras|RASCS_OpenPort|Constant for RAS state.
ADD_CONSTANT(RASCS_PortOpened); // @const win32ras|RASCS_PortOpened|Constant for RAS state.
--- 826,830 ----
static int AddConstants(PyObject *module)
{
! int rc;
ADD_CONSTANT(RASCS_OpenPort); // @const win32ras|RASCS_OpenPort|Constant for RAS state.
ADD_CONSTANT(RASCS_PortOpened); // @const win32ras|RASCS_PortOpened|Constant for RAS state.
***************
*** 858,906 ****
}
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initwin32ras(void)
! #else
! PyObject *PyInit_win32ras(void)
! #endif
{
! PyWinGlobals_Ensure();
! PyObject *dict, *module;
!
! #if (PY_VERSION_HEX < 0x03000000)
! #define RETURN_ERROR return;
! module = Py_InitModule("win32ras", win32ras_functions);
! if (!module)
! return;
! dict = PyModule_GetDict(module);
! if (!dict)
! return;
! #else
- #define RETURN_ERROR return NULL;
- static PyModuleDef win32ras_def = {
- PyModuleDef_HEAD_INIT,
- "win32ras",
- "A module encapsulating the Windows Remote Access Service (RAS) API.",
- -1,
- win32ras_functions
- };
- module = PyModule_Create(&win32ras_def);
- if (!module)
- return NULL;
- dict = PyModule_GetDict(module);
- if (!dict)
- return NULL;
- #endif
module_error = PyWinExc_ApiError;
Py_INCREF(module_error);
PyDict_SetItemString(dict, "error", module_error);
if (PyType_Ready(&PyRASDIALEXTENSIONS::type) == -1)
! RETURN_ERROR;
if (AddConstants(module) != 0)
! RETURN_ERROR;
! #if (PY_VERSION_HEX >= 0x03000000)
! return module;
! #endif
}
--- 858,874 ----
}
! PYWIN_MODULE_INIT_FUNC(win32ras)
{
! PYWIN_MODULE_INIT_PREPARE(win32ras, win32ras_functions,
! "A module encapsulating the Windows Remote Access Service (RAS) API.");
module_error = PyWinExc_ApiError;
Py_INCREF(module_error);
PyDict_SetItemString(dict, "error", module_error);
if (PyType_Ready(&PyRASDIALEXTENSIONS::type) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
if (AddConstants(module) != 0)
! PYWIN_MODULE_INIT_RETURN_ERROR;
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: win32trace.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32trace.cpp,v
retrieving revision 1.14.2.2
retrieving revision 1.14.2.3
diff -C2 -d -r1.14.2.2 -r1.14.2.3
*** win32trace.cpp 30 Oct 2008 02:41:41 -0000 1.14.2.2
--- win32trace.cpp 8 Dec 2008 13:41:06 -0000 1.14.2.3
***************
*** 604,646 ****
};
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initwin32trace(void)
! #else
! PyObject *PyInit_win32trace(void)
! #endif
{
! PyObject *dict, *module;
! PyWinGlobals_Ensure();
!
! #if (PY_VERSION_HEX < 0x03000000)
! #define RETURN_ERROR return;
! module = Py_InitModule("win32trace", win32trace_functions);
! if (!module)
! return;
! dict = PyModule_GetDict(module);
! if (!dict)
! return;
! #else
! #define RETURN_ERROR return NULL;
! static PyModuleDef win32trace_def = {
! PyModuleDef_HEAD_INIT,
! "win32trace",
! "Interface to the Windows Console functions for dealing with character-mode applications.",
! -1,
! win32trace_functions
! };
! module = PyModule_Create(&win32trace_def);
! if (!module)
! return NULL;
! dict = PyModule_GetDict(module);
! if (!dict)
! return NULL;
! #endif
if (PyType_Ready(&PyTraceObjectType) == -1)
! RETURN_ERROR;
if (PyDict_SetItemString(dict, "error", PyWinExc_ApiError) == -1)
! RETURN_ERROR;
// Allocate memory for the security descriptor.
--- 604,616 ----
};
! PYWIN_MODULE_INIT_FUNC(win32trace)
{
! PYWIN_MODULE_INIT_PREPARE(win32trace, win32trace_functions,
! "Interface to the Windows Console functions for dealing with character-mode applications.");
if (PyType_Ready(&PyTraceObjectType) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
if (PyDict_SetItemString(dict, "error", PyWinExc_ApiError) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
// Allocate memory for the security descriptor.
***************
*** 697,701 ****
if (hMutex==NULL) {
PyWin_SetAPIError("CreateMutex");
! RETURN_ERROR ;
}
assert (hEvent==NULL);
--- 667,671 ----
if (hMutex==NULL) {
PyWin_SetAPIError("CreateMutex");
! PYWIN_MODULE_INIT_RETURN_ERROR;
}
assert (hEvent==NULL);
***************
*** 703,707 ****
if (hEvent==NULL) {
PyWin_SetAPIError("CreateEvent");
! RETURN_ERROR;
}
assert (hEventEmpty==NULL);
--- 673,677 ----
if (hEvent==NULL) {
PyWin_SetAPIError("CreateEvent");
! PYWIN_MODULE_INIT_RETURN_ERROR;
}
assert (hEventEmpty==NULL);
***************
*** 709,716 ****
if (hEventEmpty==NULL) {
PyWin_SetAPIError("CreateEvent");
! RETURN_ERROR ;
}
! #if (PY_VERSION_HEX >= 0x03000000)
! return module;
! #endif
}
--- 679,684 ----
if (hEventEmpty==NULL) {
PyWin_SetAPIError("CreateEvent");
! PYWIN_MODULE_INIT_RETURN_ERROR;
}
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: mmapfilemodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/mmapfilemodule.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
*** mmapfilemodule.cpp 29 Aug 2008 04:59:26 -0000 1.4.2.1
--- mmapfilemodule.cpp 8 Dec 2008 13:41:06 -0000 1.4.2.2
***************
*** 654,699 ****
};
!
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initmmapfile(void)
! {
! PyObject *dict, *module;
! PyWinGlobals_Ensure();
! module = Py_InitModule ("mmapfile", mmapfile_functions);
! if (!module) /* Eeek - some serious error! */
! return;
! dict = PyModule_GetDict (module);
! if (!dict) return; /* Another serious error!*/
!
! Py_INCREF(PyWinExc_ApiError);
! PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
! }
!
! #else
! PyObject *PyInit_mmapfile(void)
{
- PyObject *dict, *module;
- PyWinGlobals_Ensure();
-
- static PyModuleDef mmapfile_def = {
- PyModuleDef_HEAD_INIT,
- "mmapfile",
- "Compiled extension module that provides access to the memory mapped file API",
- -1,
- mmapfile_functions
- };
- module = PyModule_Create(&mmapfile_def);
- if (!module)
- return NULL;
- dict = PyModule_GetDict(module);
- if (!dict)
- return NULL;
if (PyDict_SetItemString(dict, "error", PyWinExc_ApiError) == -1)
! return NULL;
if (PyType_Ready(&mmapfile_object_type) == -1)
! return NULL;
! return module;
}
- #endif
--- 654,667 ----
};
! PYWIN_MODULE_INIT_FUNC(mmapfile)
{
+ PYWIN_MODULE_INIT_PREPARE(mmapfile, mmapfile_functions,
+ "Compiled extension module that provides access to the memory mapped file API");
if (PyDict_SetItemString(dict, "error", PyWinExc_ApiError) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
if (PyType_Ready(&mmapfile_object_type) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
!
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: win32apimodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32apimodule.cpp,v
retrieving revision 1.89.2.2
retrieving revision 1.89.2.3
diff -C2 -d -r1.89.2.2 -r1.89.2.3
*** win32apimodule.cpp 12 Oct 2008 01:43:10 -0000 1.89.2.2
--- win32apimodule.cpp 8 Dec 2008 13:41:06 -0000 1.89.2.3
***************
*** 6247,6284 ****
};
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initwin32api(void)
! #else
! PyObject *PyInit_win32api(void)
! #endif
{
! PyObject *dict, *module;
! PyWinGlobals_Ensure();
!
! #if (PY_VERSION_HEX < 0x03000000)
! #define RETURN_ERROR return;
! module = Py_InitModule("win32api", win32api_functions);
! if (!module)
! return;
! dict = PyModule_GetDict(module);
! if (!dict)
! return;
! #else
! #define RETURN_ERROR return NULL;
! static PyModuleDef win32api_def = {
! PyModuleDef_HEAD_INIT,
! "win32api",
! "Wraps general API functions that are not subsumed in the more specific modules",
! -1,
! win32api_functions
! };
! module = PyModule_Create(&win32api_def);
! if (!module)
! return NULL;
! dict = PyModule_GetDict(module);
! if (!dict)
! return NULL;
! #endif
PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
--- 6247,6254 ----
};
! PYWIN_MODULE_INIT_FUNC(win32api)
{
! PYWIN_MODULE_INIT_PREPARE(win32api, win32api_functions,
! "Wraps general API functions that are not subsumed in the more specific modules");
PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
***************
*** 6292,6297 ****
if (PyType_Ready(&PyDISPLAY_DEVICEType) == -1
|| PyDict_SetItemString(dict, "PyDISPLAY_DEVICEType", (PyObject *)&PyDISPLAY_DEVICEType) == -1)
! RETURN_ERROR;
!
PyModule_AddIntConstant(module, "NameUnknown", NameUnknown);
--- 6262,6266 ----
if (PyType_Ready(&PyDISPLAY_DEVICEType) == -1
|| PyDict_SetItemString(dict, "PyDISPLAY_DEVICEType", (PyObject *)&PyDISPLAY_DEVICEType) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
PyModule_AddIntConstant(module, "NameUnknown", NameUnknown);
***************
*** 6399,6404 ****
}
! #if (PY_VERSION_HEX >= 0x03000000)
! return module;
! #endif
! }
--- 6368,6371 ----
}
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
! }
Index: win32clipboardmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32clipboardmodule.cpp,v
retrieving revision 1.23.2.3
retrieving revision 1.23.2.4
diff -C2 -d -r1.23.2.3 -r1.23.2.4
*** win32clipboardmodule.cpp 4 Dec 2008 00:07:22 -0000 1.23.2.3
--- win32clipboardmodule.cpp 8 Dec 2008 13:41:06 -0000 1.23.2.4
***************
*** 1182,1232 ****
}
!
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initwin32clipboard(void)
{
! PyObject *dict, *module;
! PyWinGlobals_Ensure();
! module = Py_InitModule("win32clipboard", clipboard_functions);
! if (!module) /* Eeek - some serious error! */
! return;
! dict = PyModule_GetDict(module);
! if (!dict) return; /* Another serious error!*/
!
! AddConstants(module);
! PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
! PyDict_SetItemString(dict,"UNICODE",
! #ifdef UNICODE
! Py_True
! #else
! Py_False
! #endif
! );
! }
- #else
- PyObject *PyInit_win32clipboard(void)
- {
- PyObject *dict, *module;
- PyWinGlobals_Ensure();
- static PyModuleDef win32clipboard_def = {
- PyModuleDef_HEAD_INIT,
- "win32clipboard",
- "A module which supports the Windows Clipboard API.",
- -1,
- clipboard_functions
- };
- module = PyModule_Create(&win32clipboard_def);
- if (!module)
- return NULL;
- dict = PyModule_GetDict(module);
- if (!dict)
- return NULL;
if (AddConstants(module) != 0)
! return NULL;
if (PyDict_SetItemString(dict, "error", PyWinExc_ApiError)==-1)
! return NULL;
! PyDict_SetItemString(dict,"UNICODE",
#ifdef UNICODE
Py_True
--- 1182,1195 ----
}
! PYWIN_MODULE_INIT_FUNC(win32clipboard)
{
! PYWIN_MODULE_INIT_PREPARE(win32clipboard, clipboard_functions,
! "A module which supports the Windows Clipboard API.");
if (AddConstants(module) != 0)
! PYWIN_MODULE_INIT_RETURN_ERROR;
if (PyDict_SetItemString(dict, "error", PyWinExc_ApiError)==-1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
! if (PyDict_SetItemString(dict,"UNICODE",
#ifdef UNICODE
Py_True
***************
*** 1234,1239 ****
Py_False
#endif
! );
! return module;
}
- #endif
--- 1197,1202 ----
Py_False
#endif
! )==-1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: win32consolemodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32consolemodule.cpp,v
retrieving revision 1.13.2.3
retrieving revision 1.13.2.4
diff -C2 -d -r1.13.2.3 -r1.13.2.4
*** win32consolemodule.cpp 4 Dec 2008 00:07:22 -0000 1.13.2.3
--- win32consolemodule.cpp 8 Dec 2008 13:41:06 -0000 1.13.2.4
***************
*** 2053,2093 ****
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initwin32console(void)
! #else
! PyObject *PyInit_win32console(void)
! #endif
{
! PyObject *dict, *module;
! PyWinGlobals_Ensure();
!
! #if (PY_VERSION_HEX < 0x03000000)
! #define RETURN_ERROR return;
! module = Py_InitModule("win32console", win32console_functions);
! if (!module)
! return;
! dict = PyModule_GetDict(module);
! if (!dict)
! return;
! #else
!
! #define RETURN_ERROR return NULL;
! static PyModuleDef win32console_def = {
! PyModuleDef_HEAD_INIT,
! "win32console",
! "Interface to the Windows Console functions for dealing with character-mode applications.",
! -1,
! win32console_functions
! };
! module = PyModule_Create(&win32console_def);
! if (!module)
! return NULL;
! dict = PyModule_GetDict(module);
! if (!dict)
! return NULL;
! #endif
- Py_INCREF(PyWinExc_ApiError);
PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
--- 2053,2061 ----
! PYWIN_MODULE_INIT_FUNC(win32console)
{
! PYWIN_MODULE_INIT_PREPARE(win32console, win32console_functions,
! "Interface to the Windows Console functions for dealing with character-mode applications.");
PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
***************
*** 2117,2138 ****
if (PyType_Ready(&PyConsoleScreenBufferType)==-1)
! RETURN_ERROR;
if (PyDict_SetItemString(dict, "PyConsoleScreenBufferType", (PyObject *)&PyConsoleScreenBufferType) == -1)
! RETURN_ERROR;
if (PyType_Ready(&PySMALL_RECTType)==-1)
! RETURN_ERROR;
if (PyDict_SetItemString(dict, "PySMALL_RECTType", (PyObject *)&PySMALL_RECTType) == -1)
! RETURN_ERROR;
if (PyType_Ready(&PyCOORDType)==-1)
! RETURN_ERROR;
if (PyDict_SetItemString(dict, "PyCOORDType", (PyObject *)&PyCOORDType) == -1)
! RETURN_ERROR;
if (PyType_Ready(&PyINPUT_RECORDType)==-1)
! RETURN_ERROR;
if (PyDict_SetItemString(dict, "PyINPUT_RECORDType", (PyObject *)&PyINPUT_RECORDType) == -1)
! RETURN_ERROR;
PyModule_AddIntConstant(module, "CONSOLE_TEXTMODE_BUFFER", CONSOLE_TEXTMODE_BUFFER);
--- 2085,2106 ----
if (PyType_Ready(&PyConsoleScreenBufferType)==-1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
if (PyDict_SetItemString(dict, "PyConsoleScreenBufferType", (PyObject *)&PyConsoleScreenBufferType) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
if (PyType_Ready(&PySMALL_RECTType)==-1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
if (PyDict_SetItemString(dict, "PySMALL_RECTType", (PyObject *)&PySMALL_RECTType) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
if (PyType_Ready(&PyCOORDType)==-1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
if (PyDict_SetItemString(dict, "PyCOORDType", (PyObject *)&PyCOORDType) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
if (PyType_Ready(&PyINPUT_RECORDType)==-1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
if (PyDict_SetItemString(dict, "PyINPUT_RECORDType", (PyObject *)&PyINPUT_RECORDType) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
PyModule_AddIntConstant(module, "CONSOLE_TEXTMODE_BUFFER", CONSOLE_TEXTMODE_BUFFER);
***************
*** 2195,2200 ****
PyModule_AddIntConstant(module, "CONSOLE_WINDOWED_MODE", 2);
! #if (PY_VERSION_HEX >= 0x03000000)
! return module;
! #endif
}
--- 2163,2166 ----
PyModule_AddIntConstant(module, "CONSOLE_WINDOWED_MODE", 2);
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: win32transactionmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32transactionmodule.cpp,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -C2 -d -r1.3.2.1 -r1.3.2.2
*** win32transactionmodule.cpp 29 Aug 2008 04:59:28 -0000 1.3.2.1
--- win32transactionmodule.cpp 8 Dec 2008 13:41:06 -0000 1.3.2.2
***************
*** 244,281 ****
};
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initwin32transaction(void)
! #else
! PyObject *PyInit_win32transaction(void)
! #endif
{
! PyObject *dict, *module;
! PyWinGlobals_Ensure();
!
! #if (PY_VERSION_HEX < 0x03000000)
! module = Py_InitModule("win32transaction", win32transaction_functions);
! if (!module)
! return;
! dict = PyModule_GetDict(module);
! if (!dict)
! return;
!
! #else
! static PyModuleDef win32transaction_def = {
! PyModuleDef_HEAD_INIT,
! "win32transaction",
! "Module wrapping Kernal Transaction Manager functions, as used with"
! " transacted NTFS and transacted registry functions.",
! -1,
! win32transaction_functions
! };
! module = PyModule_Create(&win32transaction_def);
! if (!module)
! return NULL;
! dict = PyModule_GetDict(module);
! if (!dict)
! return NULL;
! #endif
// Load dll and function pointers to avoid dependency on newer libraries and headers
--- 244,252 ----
};
! PYWIN_MODULE_INIT_FUNC(win32transaction)
{
! PYWIN_MODULE_INIT_PREPARE(win32transaction, win32transaction_functions,
! "Module wrapping Kernal Transaction Manager functions, as used with"
! " transacted NTFS and transacted registry functions.");
// Load dll and function pointers to avoid dependency on newer libraries and headers
***************
*** 304,309 ****
PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
! #if (PY_VERSION_HEX >= 0x03000000)
! return module;
! #endif
}
--- 275,278 ----
PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: PyWinTypesmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypesmodule.cpp,v
retrieving revision 1.39.2.10
retrieving revision 1.39.2.11
diff -C2 -d -r1.39.2.10 -r1.39.2.11
*** PyWinTypesmodule.cpp 4 Dec 2008 00:07:22 -0000 1.39.2.10
--- PyWinTypesmodule.cpp 8 Dec 2008 13:41:06 -0000 1.39.2.11
***************
*** 991,1042 ****
! #define ADD_CONSTANT(tok) if (PyModule_AddIntConstant(module, #tok, tok) == -1) RETURN_ERROR;
#define ADD_TYPE(type_name) \
if (PyType_Ready(&Py##type_name)==-1 \
|| PyDict_SetItemString(dict, #type_name, (PyObject *)&Py##type_name) == -1) \
! RETURN_ERROR;
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initpywintypes(void)
! #else
! PyObject *PyInit_pywintypes(void)
! #endif
{
! // ensure the framework has a valid thread state to work with.
! PyWinGlobals_Ensure();
! // Note we assume the Python global lock has been acquired for us already.
! PyObject *dict, *module;
!
! #if (PY_VERSION_HEX < 0x03000000)
! #define RETURN_ERROR return;
! module = Py_InitModule("pywintypes", pywintypes_functions);
! if (!module) /* Eeek - some serious error! */
! return;
! dict = PyModule_GetDict(module);
! if (!dict)
! return; /* Another serious error!*/
!
! #else
! #define RETURN_ERROR return NULL;
! static PyModuleDef pywintypes_def = {
! PyModuleDef_HEAD_INIT,
! "pywintypes",
! "Module containing common objects and functions used by various Pywin32 modules",
! -1,
! pywintypes_functions
! };
! module = PyModule_Create(&pywintypes_def);
! if (!module)
! return NULL;
! dict = PyModule_GetDict(module);
! if (!dict)
! return NULL;
! #endif
if (PyWinExc_ApiError == NULL || PyWinExc_COMError == NULL) {
PyErr_SetString(PyExc_MemoryError, "Could not initialise the error objects");
! RETURN_ERROR;
}
--- 991,1009 ----
! #define ADD_CONSTANT(tok) if (PyModule_AddIntConstant(module, #tok, tok) == -1) PYWIN_MODULE_INIT_RETURN_ERROR;
#define ADD_TYPE(type_name) \
if (PyType_Ready(&Py##type_name)==-1 \
|| PyDict_SetItemString(dict, #type_name, (PyObject *)&Py##type_name) == -1) \
! PYWIN_MODULE_INIT_RETURN_ERROR;
! PYWIN_MODULE_INIT_FUNC(pywintypes)
{
! PYWIN_MODULE_INIT_PREPARE(pywintypes, pywintypes_functions,
! "Module containing common objects and functions used by various Pywin32 modules");
if (PyWinExc_ApiError == NULL || PyWinExc_COMError == NULL) {
PyErr_SetString(PyExc_MemoryError, "Could not initialise the error objects");
! PYWIN_MODULE_INIT_RETURN_ERROR;
}
***************
*** 1045,1054 ****
|| PyDict_SetItemString(dict, "TRUE", Py_True) == -1
|| PyDict_SetItemString(dict, "FALSE", Py_False) == -1)
! RETURN_ERROR;
ADD_CONSTANT(WAVE_FORMAT_PCM);
// Add a few types.
if (PyDict_SetItemString(dict, "UnicodeType", (PyObject *)&PyUnicode_Type) == -1)
! RETURN_ERROR;
#ifndef NO_PYWINTYPES_TIME
--- 1012,1021 ----
|| PyDict_SetItemString(dict, "TRUE", Py_True) == -1
|| PyDict_SetItemString(dict, "FALSE", Py_False) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
ADD_CONSTANT(WAVE_FORMAT_PCM);
// Add a few types.
if (PyDict_SetItemString(dict, "UnicodeType", (PyObject *)&PyUnicode_Type) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
#ifndef NO_PYWINTYPES_TIME
***************
*** 1070,1076 ****
ADD_TYPE(WAVEFORMATEXType);
! #if (PY_VERSION_HEX >= 0x03000000)
! return module;
! #endif
}
--- 1037,1041 ----
ADD_TYPE(WAVEFORMATEXType);
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: win32lzmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32lzmodule.cpp,v
retrieving revision 1.4.4.1
retrieving revision 1.4.4.2
diff -C2 -d -r1.4.4.1 -r1.4.4.2
*** win32lzmodule.cpp 29 Aug 2008 04:59:27 -0000 1.4.4.1
--- win32lzmodule.cpp 8 Dec 2008 13:41:06 -0000 1.4.4.2
***************
*** 15,19 ****
#include "lzexpand.h"
- static PyObject *module_error;
static PyObject *obHandleMap = NULL;
--- 15,18 ----
***************
*** 23,27 ****
PyObject *v = Py_BuildValue("(izs)", 0, fnName, msg);
if (v != NULL) {
! PyErr_SetObject(module_error, v);
Py_DECREF(v);
}
--- 22,26 ----
PyObject *v = Py_BuildValue("(izs)", 0, fnName, msg);
if (v != NULL) {
! PyErr_SetObject(PyWinExc_ApiError, v);
Py_DECREF(v);
}
***************
*** 63,67 ****
PyObject *v = Py_BuildValue("(iss)", err, fnName, pMsg);
if (v != NULL) {
! PyErr_SetObject(module_error, v);
Py_DECREF(v);
}
--- 62,66 ----
PyObject *v = Py_BuildValue("(iss)", err, fnName, pMsg);
if (v != NULL) {
! PyErr_SetObject(PyWinExc_ApiError, v);
Py_DECREF(v);
}
***************
*** 170,213 ****
};
!
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initwin32lz(void)
! #else
! PyObject *PyInit_win32lz(void)
! #endif
{
! PyObject *dict, *module;
! PyWinGlobals_Ensure();
!
! #if (PY_VERSION_HEX < 0x03000000)
! module = Py_InitModule("win32lz", win32lz_functions);
! if (!module)
! return;
! dict = PyModule_GetDict(module);
! if (!dict)
! return;
! #else
!
! static PyModuleDef win32lz_def = {
! PyModuleDef_HEAD_INIT,
! "win32lz",
! "A module encapsulating the Windows LZ compression routines.",
! -1,
! win32lz_functions
! };
! module = PyModule_Create(&win32lz_def);
! if (!module)
! return NULL;
! dict = PyModule_GetDict(module);
! if (!dict)
! return NULL;
! #endif
! module_error = PyString_FromString("win32lz error");
! PyDict_SetItemString(dict, "error", module_error);
! #if (PY_VERSION_HEX >= 0x03000000)
! return module;
! #endif
}
--- 169,179 ----
};
! PYWIN_MODULE_INIT_FUNC(win32lz)
{
! PYWIN_MODULE_INIT_PREPARE(win32lz, win32lz_functions,
! "A module encapsulating the Windows LZ compression routines.");
! PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: win32credmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32credmodule.cpp,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -C2 -d -r1.8.2.1 -r1.8.2.2
*** win32credmodule.cpp 29 Aug 2008 04:59:26 -0000 1.8.2.1
--- win32credmodule.cpp 8 Dec 2008 13:41:06 -0000 1.8.2.2
***************
*** 1035,1070 ****
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initwin32cred(void)
! #else
! PyObject *PyInit_win32cred(void)
! #endif
{
! PyObject *dict, *module;
! PyWinGlobals_Ensure();
!
! #if (PY_VERSION_HEX < 0x03000000)
! module = Py_InitModule("win32cred", win32cred_functions);
! if (!module)
! return;
! dict = PyModule_GetDict(module);
! if (!dict)
! return;
! #else
! static PyModuleDef win32cred_def = {
! PyModuleDef_HEAD_INIT,
! "win32cred",
! "Interface to credentials management functions.",
! -1,
! win32cred_functions
! };
! module = PyModule_Create(&win32cred_def);
! if (!module)
! return NULL;
! dict = PyModule_GetDict(module);
! if (!dict)
! return NULL;
! #endif
// CRED_MARSHAL_TYPE used with CredMarshalCredential and CredUnmarshalCredential
--- 1035,1042 ----
! PYWIN_MODULE_INIT_FUNC(win32cred)
{
! PYWIN_MODULE_INIT_PREPARE(win32cred, win32cred_functions,
! "Interface to credentials management functions.");
// CRED_MARSHAL_TYPE used with CredMarshalCredential and CredUnmarshalCredential
***************
*** 1134,1139 ****
PyModule_AddIntConstant(module, "CREDUI_MAX_PASSWORD_LENGTH", CREDUI_MAX_PASSWORD_LENGTH);
! #if (PY_VERSION_HEX >= 0x03000000)
! return module;
! #endif
}
--- 1106,1109 ----
PyModule_AddIntConstant(module, "CREDUI_MAX_PASSWORD_LENGTH", CREDUI_MAX_PASSWORD_LENGTH);
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: PyWinTypes.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypes.h,v
retrieving revision 1.51.2.5
retrieving revision 1.51.2.6
diff -C2 -d -r1.51.2.5 -r1.51.2.6
*** PyWinTypes.h 6 Dec 2008 01:48:26 -0000 1.51.2.5
--- PyWinTypes.h 8 Dec 2008 13:41:06 -0000 1.51.2.6
***************
*** 21,24 ****
--- 21,81 ----
#include "windows.h"
+
+ // Helpers for our modules.
+ // Some macros to help the pywin32 modules co-exist in py2x and py3k.
+ // Creates and initializes local variables called 'module' and 'dict'.
+
+ #if (PY_VERSION_HEX < 0x03000000)
+
+ // Use to define the function itself (ie, its name, linkage, params)
+ #define PYWIN_MODULE_INIT_FUNC(module_name) \
+ extern "C" __declspec(dllexport) void init##module_name(void)
+
+ // If the module needs to early-exit on an error condition.
+ #define PYWIN_MODULE_INIT_RETURN_ERROR return;
+
+ // When the module has successfully initialized.
+ #define PYWIN_MODULE_INIT_RETURN_SUCCESS return;
+
+ // To setup the module object itself and the module's dictionary.
+ #define PYWIN_MODULE_INIT_PREPARE(module_name, functions, docstring) \
+ PyObject *dict, *module; \
+ if (PyWinGlobals_Ensure()==-1) \
+ return; \
+ if (!(module = Py_InitModule(#module_name, functions))) \
+ return; \
+ if (!(dict = PyModule_GetDict(module))) \
+ return;
+
+ #else
+ // py3k module helpers.
+ // Use to define the function itself (ie, its name, linkage, params)
+ #define PYWIN_MODULE_INIT_FUNC(module_name) \
+ extern "C" __declspec(dllexport) PyObject *PyInit_##module_name(void)
+
+ // If the module needs to early-exit on an error condition.
+ #define PYWIN_MODULE_INIT_RETURN_ERROR return NULL;
+
+ // When the module has successfully initialized.
+ #define PYWIN_MODULE_INIT_RETURN_SUCCESS return module;
+
+ // To setup the module object itself and the module's dictionary.
+ #define PYWIN_MODULE_INIT_PREPARE(module_name, functions, docstring) \
+ PyObject *dict, *module; \
+ static PyModuleDef module_name##_def = { \
+ PyModuleDef_HEAD_INIT, \
+ #module_name, \
+ docstring , \
+ -1, \
+ functions }; \
+ if (PyWinGlobals_Ensure()==-1) \
+ return NULL; \
+ if (!(module = PyModule_Create(&module_name##_def))) \
+ return NULL; \
+ if (!(dict = PyModule_GetDict(module))) \
+ return NULL;
+ #endif // PY_VERSION_HEX
+
+
// Helpers for our types.
#if (PY_VERSION_HEX < 0x03000000)
Index: win32helpmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32helpmodule.cpp,v
retrieving revision 1.4.2.3
retrieving revision 1.4.2.4
diff -C2 -d -r1.4.2.3 -r1.4.2.4
*** win32helpmodule.cpp 3 Dec 2008 23:46:36 -0000 1.4.2.3
--- win32helpmodule.cpp 8 Dec 2008 13:41:06 -0000 1.4.2.4
***************
*** 3221,3255 ****
// Module initialization:
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initwin32help(void)
! #else
! PyObject *PyInit_win32help(void)
! #endif
{
! PyObject *dict, *module;
! PyWinGlobals_Ensure();
!
! #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,
! "win32help",
! "A module, encapsulating the Win32 help API's.",
! -1,
! win32help_functions
! };
! 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$"));
--- 3221,3230 ----
// Module initialization:
! PYWIN_MODULE_INIT_FUNC(win32help)
{
! PYWIN_MODULE_INIT_PREPARE(win32help, win32help_functions,
! "A module, encapsulating the Win32 help API's.");
if (AddConstants(module) != 0)
! PYWIN_MODULE_INIT_RETURN_ERROR;
PyDict_SetItemString(dict, "__version__",
PyString_FromString("$Revision$"));
***************
*** 3262,3270 ****
||PyType_Ready(&PyHHN_NOTIFYType) == -1
||PyType_Ready(&PyHHNTRACKType) == -1)
! RETURN_ERROR;
! #if (PY_VERSION_HEX >= 0x03000000)
! return module;
! #endif
}
-
--- 3237,3242 ----
||PyType_Ready(&PyHHN_NOTIFYType) == -1
||PyType_Ready(&PyHHNTRACKType) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: timermodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/timermodule.cpp,v
retrieving revision 1.5.2.1
retrieving revision 1.5.2.2
diff -C2 -d -r1.5.2.1 -r1.5.2.2
*** timermodule.cpp 29 Aug 2008 04:59:26 -0000 1.5.2.1
--- timermodule.cpp 8 Dec 2008 13:41:06 -0000 1.5.2.2
***************
*** 149,200 ****
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void inittimer(void)
{
! PyWinGlobals_Ensure();
! timer_id_callback_map = PyDict_New();
! if (!timer_id_callback_map)
! return;
!
! PyObject *dict, *module;
! module = Py_InitModule("timer", timer_functions);
! if (!module) return;
! dict = PyModule_GetDict(module);
! if (!dict)
! return;
!
! PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
! PyDict_SetItemString(dict, "__version__", PyString_FromString("0.2"));
! }
- #else
- PyObject *PyInit_timer(void)
- {
- PyWinGlobals_Ensure();
timer_id_callback_map = PyDict_New();
if (!timer_id_callback_map)
! return NULL;
!
! PyObject *dict, *module;
! static PyModuleDef timer_def = {
! PyModuleDef_HEAD_INIT,
! "timer",
! "Extension that wraps Win32 Timer functions",
! -1,
! timer_functions
! };
! module = PyModule_Create(&timer_def);
! if (!module)
! return NULL;
! dict = PyModule_GetDict(module);
! if (!dict)
! return NULL;
if (PyDict_SetItemString(dict, "error", PyWinExc_ApiError) == -1)
! return NULL;
if (PyDict_SetItemString(dict, "__version__", PyString_FromString("0.2")) == -1)
! return NULL;
! return module;
}
- #endif
--- 149,166 ----
! PYWIN_MODULE_INIT_FUNC(timer)
{
! PYWIN_MODULE_INIT_PREPARE(timer, timer_functions,
! "Extension that wraps Win32 Timer functions");
timer_id_callback_map = PyDict_New();
if (!timer_id_callback_map)
! PYWIN_MODULE_INIT_RETURN_ERROR
if (PyDict_SetItemString(dict, "error", PyWinExc_ApiError) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
if (PyDict_SetItemString(dict, "__version__", PyString_FromString("0.2")) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
!
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: win2krasmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win2krasmodule.cpp,v
retrieving revision 1.6.2.2
retrieving revision 1.6.2.3
diff -C2 -d -r1.6.2.2 -r1.6.2.3
*** win2krasmodule.cpp 2 Sep 2008 09:39:31 -0000 1.6.2.2
--- win2krasmodule.cpp 8 Dec 2008 13:41:06 -0000 1.6.2.3
***************
*** 205,248 ****
}
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initwin2kras(void)
! #else
! PyObject *PyInit_win2kras(void)
! #endif
{
! PyWinGlobals_Ensure();
! PyObject *dict, *module;
!
! #if (PY_VERSION_HEX < 0x03000000)
! #define RETURN_ERROR return;
! module = Py_InitModule("win2kras", win2kras_functions);
! if (!module)
! return;
! dict = PyModule_GetDict(module);
! if (!dict)
! return;
! #else
!
! #define RETURN_ERROR return NULL;
! static PyModuleDef win2kras_def = {
! PyModuleDef_HEAD_INIT,
! "win2kras",
! "A module encapsulating the Windows 2000 extensions to the Remote Access Service (RAS) API.",
! -1,
! win2kras_functions
! };
! module = PyModule_Create(&win2kras_def);
! if (!module)
! return NULL;
! dict = PyModule_GetDict(module);
! if (!dict)
! return NULL;
! #endif
if (PyType_Ready(&PyRASEAPUSERIDENTITY::type) == -1)
! RETURN_ERROR;
if (AddConstants(module) != 0)
! RETURN_ERROR;
#ifdef _DEBUG
--- 205,217 ----
}
! PYWIN_MODULE_INIT_FUNC(win2kras)
{
! PYWIN_MODULE_INIT_PREPARE(win2kras, win2kras_functions,
! "A module encapsulating the Windows 2000 extensions to the Remote Access Service (RAS) API.");
if (PyType_Ready(&PyRASEAPUSERIDENTITY::type) == -1)
! PYWIN_MODULE_INIT_RETURN_ERROR;
if (AddConstants(module) != 0)
! PYWIN_MODULE_INIT_RETURN_ERROR;
#ifdef _DEBUG
***************
*** 261,275 ****
if (hmod==NULL) {
PyErr_SetString(PyExc_RuntimeError, "You must import 'win32ras' before importing this module");
! RETURN_ERROR;
}
FARPROC fp = GetProcAddress(hmod, "ReturnRasError");
if (fp==NULL) {
PyErr_SetString(PyExc_RuntimeError, "Could not locate 'ReturnRasError' in 'win32ras'");
! RETURN_ERROR;
}
pfnReturnRasError = (PFNReturnRasError)fp;
! #if (PY_VERSION_HEX >= 0x03000000)
! return module;
! #endif
}
--- 230,242 ----
if (hmod==NULL) {
PyErr_SetString(PyExc_RuntimeError, "You must import 'win32ras' before importing this module");
! PYWIN_MODULE_INIT_RETURN_ERROR;
}
FARPROC fp = GetProcAddress(hmod, "ReturnRasError");
if (fp==NULL) {
PyErr_SetString(PyExc_RuntimeError, "Could not locate 'ReturnRasError' in 'win32ras'");
! PYWIN_MODULE_INIT_RETURN_ERROR;
}
pfnReturnRasError = (PFNReturnRasError)fp;
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: win32pdhmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32pdhmodule.cpp,v
retrieving revision 1.17.2.5
retrieving revision 1.17.2.6
diff -C2 -d -r1.17.2.5 -r1.17.2.6
*** win32pdhmodule.cpp 30 Sep 2008 02:03:00 -0000 1.17.2.5
--- win32pdhmodule.cpp 8 Dec 2008 13:41:06 -0000 1.17.2.6
***************
*** 1119,1155 ****
#define ADD_CONSTANT(tok) PyModule_AddIntConstant(module, #tok, tok)
! extern"C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initwin32pdh(void)
! #else
! PyObject *PyInit_win32pdh(void)
! #endif
{
InitializeCriticalSection(&critSec);
- PyObject *dict, *module;
-
- #if (PY_VERSION_HEX < 0x03000000)
- #define RETURN_ERROR return;
- module = Py_InitModule("win32pdh", win32pdh_functions);
- #else
-
- #define RETURN_ERROR return NULL;
- static PyModuleDef win32pdh_def = {
- PyModuleDef_HEAD_INIT,
- "win32pdh",
- "A module, encapsulating the Windows Performance Data Helpers API",
- -1,
- win32pdh_functions
- };
- module = PyModule_Create(&win32pdh_def);
- #endif
-
- if (!module)
- RETURN_ERROR;
- dict = PyModule_GetDict(module);
- if (!dict)
- RETURN_ERROR;
- if (PyWinGlobals_Ensure() == -1)
- RETURN_ERROR;
PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
--- 1119,1127 ----
#define ADD_CONSTANT(tok) PyModule_AddIntConstant(module, #tok, tok)
! PYWIN_MODULE_INIT_FUNC(win32pdh)
{
+ PYWIN_MODULE_INIT_PREPARE(win32pdh, win32pdh_functions,
+ "A module, encapsulating the Windows Performance Data Helpers API");
InitializeCriticalSection(&critSec);
PyDict_SetItemString(dict, "error", PyWinExc_ApiError);
***************
*** 1178,1183 ****
ADD_CONSTANT(PERF_DETAIL_WIZARD);
// ADD_CONSTANT();
! #if (PY_VERSION_HEX >= 0x03000000)
! return module;
! #endif
}
--- 1150,1153 ----
ADD_CONSTANT(PERF_DETAIL_WIZARD);
// ADD_CONSTANT();
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
Index: win32tsmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32tsmodule.cpp,v
retrieving revision 1.4.2.2
retrieving revision 1.4.2.3
diff -C2 -d -r1.4.2.2 -r1.4.2.3
*** win32tsmodule.cpp 25 Oct 2008 00:19:13 -0000 1.4.2.2
--- win32tsmodule.cpp 8 Dec 2008 13:41:06 -0000 1.4.2.3
***************
*** 689,724 ****
! extern "C" __declspec(dllexport)
! #if (PY_VERSION_HEX < 0x03000000)
! void initwin32ts(void)
! #else
! PyObject *PyInit_win32ts(void)
! #endif
{
! PyObject *dict, *module;
! PyWinGlobals_Ensure();
!
! #if (PY_VERSION_HEX < 0x03000000)
! module = Py_InitModule("win32ts", win32ts_functions);
! if (!module)
! return;
! dict = PyModule_GetDict(module);
! if (!dict)
! return;
! #else
! static PyModuleDef win32ts_def = {
! PyModuleDef_HEAD_INIT,
! "win32ts",
! "Interface to the Terminal Services Api.",
! -1,
! win32ts_functions
! };
! module = PyModule_Create(&win32ts_def);
! if (!module)
! return NULL;
! dict = PyModule_GetDict(module);
! if (!dict)
! return NULL;
! #endif
// WTS_CONNECTSTATE_CLASS
--- 689,696 ----
! PYWIN_MODULE_INIT_FUNC(win32ts)
{
! PYWIN_MODULE_INIT_PREPARE(win32ts, win32ts_functions,
! "Interface to the Terminal Services Api.");
// WTS_CONNECTSTATE_CLASS
***************
*** 830,835 ****
}
! #if (PY_VERSION_HEX >= 0x03000000)
! return module;
! #endif
}
--- 802,805 ----
}
! PYWIN_MODULE_INIT_RETURN_SUCCESS;
}
|