Files
MINGW-packages/mingw-w64-python-pywin32/005-swig-fix.patch
2023-04-08 05:16:27 +08:00

123 lines
3.3 KiB
Diff

diff -urN pywin32-b306-orig/SWIG/swig_lib/python/pythoncom.i pywin32-b306/SWIG/swig_lib/python/pythoncom.i
--- pywin32-b306-orig/SWIG/swig_lib/python/pythoncom.i 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/SWIG/swig_lib/python/pythoncom.i 2023-04-07 09:36:26.662919300 +0800
@@ -8,6 +8,10 @@
%typedef long HRESULT_KEEP; // This will keep HRESULT, and return
typedef long FLAGS;
+typedef WCHAR OLECHAR;
+typedef OLECHAR* BSTR;
+typedef MAPIERROR MAPIERROR;
+typedef ADRLIST ADRLIST;
%typemap(python,out) HRESULT {
$target = Py_None;
diff -urN pywin32-b306-orig/SWIG/swig_lib/python/pywintypes.i pywin32-b306/SWIG/swig_lib/python/pywintypes.i
--- pywin32-b306-orig/SWIG/swig_lib/python/pywintypes.i 2023-03-26 07:53:26.000000000 +0800
+++ pywin32-b306/SWIG/swig_lib/python/pywintypes.i 2023-04-07 09:36:26.714869100 +0800
@@ -33,6 +33,8 @@
typedef unsigned long ULONG;
%apply unsigned long {ULONG};
+typedef STARTUPINFO STARTUPINFO;
+%apply STARTUPINFO {STARTUPINFO};
%{
#define PyInt_FromLong PyLong_FromLong // py3k pain.
@@ -55,6 +57,7 @@
}
// Override the SWIG default for this.
+%typedef PyObject PyObject;
%typemap(python,out) PyObject *{
if ($source==NULL) return NULL; // get out now!
$target = $source;
@@ -64,7 +67,7 @@
// Map API functions that return BOOL to
// functions that return None, but raise exceptions.
// These functions must set the win32 LastError.
-%typedef BOOL BOOLAPI
+%typedef BOOL BOOLAPI;
%typemap(python,out) BOOLAPI {
$target = Py_None;
@@ -81,7 +84,7 @@
}
}
-%typedef DWORD DWORDAPI
+%typedef DWORD DWORDAPI;
%typemap(python,out) DWORDAPI {
$target = Py_None;
@@ -110,11 +113,13 @@
}
}
+%typedef TCHAR TCHAR;
%typemap(python,in) TCHAR * {
if (!PyWinObject_AsTCHAR($source, &$target, FALSE))
return NULL;
}
+%typedef WCHAR WCHAR;
%typemap(python,arginit) TCHAR *,OLECHAR *, WCHAR *
{
$target = NULL;
@@ -200,6 +205,7 @@
return NULL;
}
+%typedef OVERLAPPED OVERLAPPED;
%typemap(python,in) OVERLAPPED *
{
if (!PyWinObject_AsOVERLAPPED($source, &$target, TRUE))
@@ -254,6 +260,7 @@
}
+%typedef SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES;
%typemap(python,in) SECURITY_ATTRIBUTES *{
if (!PyWinObject_AsSECURITY_ATTRIBUTES($source, &$target))
@@ -408,6 +415,7 @@
// LARGE_INTEGER support
//
//---------------------------------------------------------------------------
+%typedef LARGE_INTEGER LARGE_INTEGER;
%typemap(python,in) LARGE_INTEGER {
if (!PyWinObject_AsLARGE_INTEGER($source, &$target))
return NULL;
@@ -417,6 +425,7 @@
if (!PyWinObject_AsLARGE_INTEGER($source, $target))
return NULL;
}
+%typedef ULARGE_INTEGER ULARGE_INTEGER;
%typemap(python,in) ULARGE_INTEGER {
if (!PyWinObject_AsULARGE_INTEGER($source, &$target))
return NULL;
@@ -531,6 +540,7 @@
// TIME
//
//---------------------------------------------------------------------------
+%typedef FILETIME FILETIME;
%typemap(python,in) FILETIME * {
if (!PyWinObject_AsFILETIME($source, $target, FALSE))
return NULL;
@@ -569,6 +579,7 @@
// SOCKET support.
//
//---------------------------------------------------------------------------
+%typedef UINT_PTR SOCKET;
%typemap(python,in) SOCKET *(SOCKET sockettemp)
{
$target = &sockettemp;
@@ -592,6 +603,6 @@
#endif
PyWinGlobals_Ensure();
PyDict_SetItemString(d, "error", PyWinExc_ApiError);
-#endif SWIG_PYTHONCOM
+#endif // SWIG_PYTHONCOM
%}