Update of /cvsroot/pywin32/pywin32/Pythonwin
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv6868
Modified Files:
Tag: py3k
stdafxole.h win32ui.h win32uimodule.cpp
Log Message:
Various pythonwin fixes to get things working for markh
Index: win32ui.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32ui.h,v
retrieving revision 1.7.2.3
retrieving revision 1.7.2.4
diff -C2 -d -r1.7.2.3 -r1.7.2.4
*** win32ui.h 4 Sep 2008 02:27:19 -0000 1.7.2.3
--- win32ui.h 1 Oct 2008 13:50:54 -0000 1.7.2.4
***************
*** 38,41 ****
--- 38,46 ----
#define XDODECREF(o) Py_XDECREF(o)
+ inline PyObject *PyWinObject_FromTCHAR(CString *str )
+ {
+ return PyWinObject_FromTCHAR((const TCHAR *)str);
+ }
+
// we cant use these memory operators - must use make and python handles delete
#undef NEWOBJ
Index: stdafxole.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/stdafxole.h,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -C2 -d -r1.2 -r1.2.4.1
*** stdafxole.h 14 Mar 2000 23:29:09 -0000 1.2
--- stdafxole.h 1 Oct 2008 13:50:54 -0000 1.2.4.1
***************
*** 28,31 ****
--- 28,32 ----
// dont need all of these for all, but it cant hurt (and keep the speed up!)
+ #include "pywintypes.h"
#include "win32ui.h"
#include "win32assoc.h"
Index: win32uimodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32uimodule.cpp,v
retrieving revision 1.39.2.3
retrieving revision 1.39.2.4
diff -C2 -d -r1.39.2.3 -r1.39.2.4
*** win32uimodule.cpp 19 Sep 2008 00:03:09 -0000 1.39.2.3
--- win32uimodule.cpp 1 Oct 2008 13:50:54 -0000 1.39.2.4
***************
*** 272,275 ****
--- 272,280 ----
// ??? I think this leaks a ref to obattr ???
+ // Right - we are *replacing* 'o' so the caller magically gets the
+ // _obj_ - so there is definately a leak here: Either:
+ // * Callers do manage ref-counts correctly - in which case we must
+ // decref the existing object before swapping the value.
+ // * Callers don't manage ref-counts correctly - they need to be fixed.
o = obattr;
return is_uiobject(o, which);
***************
*** 329,335 ****
CString ui_base_class::repr()
{
- USES_CONVERSION;
CString csRet;
! csRet.Format(_T("object '%s'"), A2T(ob_type->tp_name));
return csRet;
}
--- 334,344 ----
CString ui_base_class::repr()
{
CString csRet;
! #if (PY_VERSION_HEX < 0x03000000)
! USES_CONVERSION;
! csRet.Format(_T("object '%s'"), A2T(ob_type->tp_name));
! #else
! csRet.Format(_T("object '%S'"), ob_type->tp_name);
! #endif
return csRet;
}
***************
*** 602,605 ****
--- 611,619 ----
if (bInError) {
TRACE("gui_print_error: recursive call!\n");
+ PyObject *type, *value, *traceback;
+ PyErr_Fetch(&type, &value, &traceback);
+ TRACE(GetPythonTraceback(type, value, traceback));
+ PyErr_Restore(type, value, traceback);
+ PyErr_Clear();
return;
}
***************
*** 643,646 ****
--- 657,661 ----
else
TRACE("DefaultExceptionHandler: unknown action (%d)\n", action);
+ PyErr_Clear();
}
***************
*** 2449,2462 ****
// a risk that when Python does "import win32ui", it
// will locate a different one, causing obvious grief!
#if (PY_VERSION_HEX < 0x03000000)
initwin32ui();
- #else
- PyInit_win32ui();
- #endif
-
// Set sys.argv if not already done!
- PyObject *argv = PySys_GetObject("argv");
if (argv==NULL && __targv!=NULL && __argc > 0)
PySys_SetArgv(__argc-1, __targv+1);
// If the versions of the .h file are not in synch, then we are in trouble!
if (pGlue->versionNo != WIN32UIHOSTGLUE_VERSION) {
--- 2464,2484 ----
// a risk that when Python does "import win32ui", it
// will locate a different one, causing obvious grief!
+ PyObject *argv = PySys_GetObject("argv");
#if (PY_VERSION_HEX < 0x03000000)
initwin32ui();
// Set sys.argv if not already done!
if (argv==NULL && __targv!=NULL && __argc > 0)
PySys_SetArgv(__argc-1, __targv+1);
+ #else
+ PyInit_win32ui();
+ if (argv==NULL) {
+ int myargc;
+ LPWSTR *myargv = CommandLineToArgvW(GetCommandLineW(), &myargc);
+ if (myargv) {
+ PySys_SetArgv(myargc-1, myargv+1);
+ LocalFree(myargv);
+ }
+ }
+ #endif
// If the versions of the .h file are not in synch, then we are in trouble!
if (pGlue->versionNo != WIN32UIHOSTGLUE_VERSION) {
|