pywin32-checkins Mailing List for Python for Windows Extensions (Page 55)
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(6) |
Jul
(50) |
Aug
(11) |
Sep
(24) |
Oct
(184) |
Nov
(118) |
Dec
(22) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(31) |
Feb
(25) |
Mar
(34) |
Apr
(105) |
May
(49) |
Jun
(38) |
Jul
(39) |
Aug
(7) |
Sep
(98) |
Oct
(79) |
Nov
(20) |
Dec
(17) |
2005 |
Jan
(66) |
Feb
(32) |
Mar
(43) |
Apr
(30) |
May
(58) |
Jun
(30) |
Jul
(16) |
Aug
(4) |
Sep
(21) |
Oct
(42) |
Nov
(11) |
Dec
(14) |
2006 |
Jan
(42) |
Feb
(30) |
Mar
(22) |
Apr
(1) |
May
(9) |
Jun
(15) |
Jul
(20) |
Aug
(9) |
Sep
(8) |
Oct
(1) |
Nov
(9) |
Dec
(43) |
2007 |
Jan
(52) |
Feb
(45) |
Mar
(20) |
Apr
(12) |
May
(59) |
Jun
(39) |
Jul
(35) |
Aug
(31) |
Sep
(17) |
Oct
(20) |
Nov
(4) |
Dec
(4) |
2008 |
Jan
(28) |
Feb
(111) |
Mar
(4) |
Apr
(27) |
May
(40) |
Jun
(27) |
Jul
(32) |
Aug
(94) |
Sep
(87) |
Oct
(153) |
Nov
(336) |
Dec
(331) |
2009 |
Jan
(298) |
Feb
(127) |
Mar
(20) |
Apr
(8) |
May
|
Jun
(10) |
Jul
(6) |
Aug
|
Sep
(2) |
Oct
(2) |
Nov
|
Dec
(1) |
2010 |
Jan
(7) |
Feb
(1) |
Mar
|
Apr
|
May
(15) |
Jun
(4) |
Jul
(3) |
Aug
(28) |
Sep
(1) |
Oct
(19) |
Nov
(16) |
Dec
(6) |
2011 |
Jan
(2) |
Feb
(18) |
Mar
(17) |
Apr
(12) |
May
(5) |
Jun
(11) |
Jul
(7) |
Aug
(2) |
Sep
(2) |
Oct
(4) |
Nov
(4) |
Dec
|
2012 |
Jan
(6) |
Feb
(2) |
Mar
|
Apr
(8) |
May
(4) |
Jun
(3) |
Jul
(13) |
Aug
(27) |
Sep
(8) |
Oct
(9) |
Nov
(3) |
Dec
(2) |
2013 |
Jan
|
Feb
(1) |
Mar
(5) |
Apr
(10) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(9) |
2014 |
Jan
(2) |
Feb
(4) |
Mar
(4) |
Apr
(1) |
May
(4) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(1) |
2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
(6) |
May
(2) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
(3) |
Feb
(2) |
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
From: Mark H. <mha...@us...> - 2008-11-26 07:17:43
|
Update of /cvsroot/pywin32/pywin32/com/win32com/demos In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/com/win32com/demos Modified Files: Tag: py3k connect.py Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: connect.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/demos/connect.py,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** connect.py 9 Nov 2003 11:01:18 -0000 1.2 --- connect.py 26 Nov 2008 07:17:39 -0000 1.2.4.1 *************** *** 73,77 **** CheckEvent(server, client, "Here is a null>"+chr(0)+"<", verbose) CheckEvent(server, client, u"Here is a null>"+unichr(0)+"<", verbose) ! val = unicode("test-\xe0\xf2", "latin-1") # 2 latin characters. CheckEvent(server, client, val, verbose) if verbose: --- 73,77 ---- CheckEvent(server, client, "Here is a null>"+chr(0)+"<", verbose) CheckEvent(server, client, u"Here is a null>"+unichr(0)+"<", verbose) ! val = u"test-\xe0\xf2" # 2 extended characters. CheckEvent(server, client, val, verbose) if verbose: |
From: Mark H. <mha...@us...> - 2008-11-26 07:17:43
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/extensions In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/com/win32com/src/extensions Modified Files: Tag: py3k PyICatInformation.cpp PyIType.cpp PySTGMEDIUM.cpp Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: PySTGMEDIUM.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PySTGMEDIUM.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 *** PySTGMEDIUM.cpp 29 Aug 2008 08:27:37 -0000 1.8.2.1 --- PySTGMEDIUM.cpp 26 Nov 2008 07:17:39 -0000 1.8.2.2 *************** *** 55,69 **** const void * buf = NULL; Py_ssize_t cb = 0; ! if (PyObject_AsReadBuffer(ob,&buf,&cb)==-1) ! return PyErr_Format(PyExc_TypeError, "tymed value of %d requires a string/unicode/buffer", tymed); ! // size doesnt include nulls! // We need to include the NULL for strings and unicode, as the // Windows clipboard functions will assume it is there for // text related formats (eg, CF_TEXT). ! if (PyString_Check(ob)) ! cb += 1; ! else if (PyUnicode_Check(ob)) ! cb += sizeof(wchar_t); ! // else assume buffer needs no terminator... ps->medium.hGlobal = GlobalAlloc(GMEM_FIXED, cb); if (!ps->medium.hGlobal) --- 55,74 ---- const void * buf = NULL; Py_ssize_t cb = 0; ! // In py3k, unicode objects don't support the buffer ! // protocol, so explicitly check string types first. // We need to include the NULL for strings and unicode, as the // Windows clipboard functions will assume it is there for // text related formats (eg, CF_TEXT). ! if (PyString_Check(ob)) { ! cb = PyString_GET_SIZE(ob) + 1; // for the NULL ! buf = (void *)PyString_AS_STRING(ob); ! } else if (PyUnicode_Check(ob)) { ! cb = PyUnicode_GET_DATA_SIZE(ob) + sizeof(Py_UNICODE); ! buf = (void *)PyUnicode_AS_UNICODE(ob); ! } else { ! if (PyObject_AsReadBuffer(ob,&buf,&cb)==-1) ! return PyErr_Format(PyExc_TypeError, "tymed value of %d requires a string/unicode/buffer", tymed); ! // no extra nulls etc needed here. ! } ps->medium.hGlobal = GlobalAlloc(GMEM_FIXED, cb); if (!ps->medium.hGlobal) Index: PyIType.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PyIType.cpp,v retrieving revision 1.9.4.1 retrieving revision 1.9.4.2 diff -C2 -d -r1.9.4.1 -r1.9.4.2 *** PyIType.cpp 29 Aug 2008 08:27:37 -0000 1.9.4.1 --- PyIType.cpp 26 Nov 2008 07:17:39 -0000 1.9.4.2 *************** *** 412,416 **** return NULL; } ! LCID lcid; UINT offset = 0; if ( argc > 1 ) --- 412,416 ---- return NULL; } ! LCID lcid = LOCALE_SYSTEM_DEFAULT; UINT offset = 0; if ( argc > 1 ) Index: PyICatInformation.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PyICatInformation.cpp,v retrieving revision 1.5.4.1 retrieving revision 1.5.4.2 diff -C2 -d -r1.5.4.1 -r1.5.4.2 *** PyICatInformation.cpp 13 Sep 2008 04:26:18 -0000 1.5.4.1 --- PyICatInformation.cpp 26 Nov 2008 07:17:39 -0000 1.5.4.2 *************** *** 135,138 **** --- 135,139 ---- return PyCom_BuildPyException(hr, pMy, IID_ICatInformation); PyObject *rc = PyWinObject_FromWCHAR(pResult); + // @comm The return type is a unicode object. CoTaskMemFree(pResult); return rc; |
From: Mark H. <mha...@us...> - 2008-11-26 07:17:43
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/com/win32com/src Modified Files: Tag: py3k ErrorUtils.cpp PyIDispatch.cpp PyIUnknown.cpp Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: ErrorUtils.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/ErrorUtils.cpp,v retrieving revision 1.30.2.3 retrieving revision 1.30.2.4 diff -C2 -d -r1.30.2.3 -r1.30.2.4 *** ErrorUtils.cpp 13 Sep 2008 04:26:17 -0000 1.30.2.3 --- ErrorUtils.cpp 26 Nov 2008 07:17:39 -0000 1.30.2.4 *************** *** 184,191 **** // Note that with class based exceptions, a simple pointer check fails. // Any class sub-classed from the client is considered a server error, ! // so we need to check the class explicitely. ! if (v==PyWinExc_COMError || // String exceptions ! (PyObject_IsInstance(v, PyExc_Exception) && // Class exceptions ! ((PyObject *)v->ob_type==PyWinExc_COMError))) { // Client side error // Clear the state of the excep info. --- 184,189 ---- // Note that with class based exceptions, a simple pointer check fails. // Any class sub-classed from the client is considered a server error, ! // so we need to check the class explicitly. ! if ((PyObject *)v->ob_type==PyWinExc_COMError) { // Client side error // Clear the state of the excep info. *************** *** 496,508 **** } ! BOOL IsNonServerErrorCurrent() { BOOL rc = FALSE; PyObject *exc_typ = NULL, *exc_val = NULL, *exc_tb = NULL; PyErr_Fetch( &exc_typ, &exc_val, &exc_tb); if (exc_typ) { PyErr_NormalizeException( &exc_typ, &exc_val, &exc_tb); ! rc = (!PyErr_GivenExceptionMatches(exc_val, PyWinExc_COMError) || ! (PyObject_IsInstance(exc_val, PyExc_Exception) && ! PyObject_IsSubclass((PyObject *)exc_val->ob_type, PyWinExc_COMError))); } PyErr_Restore(exc_typ, exc_val, exc_tb); --- 494,511 ---- } ! // Is the current exception a "server" exception? - ie, one explicitly ! // thrown by Python code to indicate an error. This is defined as ! // any exception whose type is a subclass of com_error (a plain ! // com_error probably means an unhandled exception from someone ! // calling an interface) ! BOOL IsServerErrorCurrent() { BOOL rc = FALSE; PyObject *exc_typ = NULL, *exc_val = NULL, *exc_tb = NULL; PyErr_Fetch( &exc_typ, &exc_val, &exc_tb); + assert(exc_typ); // we should only be called with an exception current. if (exc_typ) { PyErr_NormalizeException( &exc_typ, &exc_val, &exc_tb); ! // so it must "match" a com_error, but not be *exactly* a COM error. ! rc = PyErr_GivenExceptionMatches(exc_val, PyWinExc_COMError) && exc_typ != PyWinExc_COMError; } PyErr_Restore(exc_typ, exc_val, exc_tb); *************** *** 527,531 **** void PyCom_LoggerNonServerException(PyObject *logProvider, const char *fmt, ...) { ! if (!IsNonServerErrorCurrent()) return; va_list marker; --- 530,534 ---- void PyCom_LoggerNonServerException(PyObject *logProvider, const char *fmt, ...) { ! if (IsServerErrorCurrent()) return; va_list marker; *************** *** 726,730 **** --- 729,735 ---- // //////////////////////////////////////////////////////////////////////// + #ifndef _countof #define _countof(array) (sizeof(array)/sizeof(array[0])) + #endif void GetScodeString(HRESULT hr, LPTSTR buf, int bufSize) Index: PyIUnknown.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyIUnknown.cpp,v retrieving revision 1.12.2.3 retrieving revision 1.12.2.4 diff -C2 -d -r1.12.2.3 -r1.12.2.4 *** PyIUnknown.cpp 13 Sep 2008 04:26:17 -0000 1.12.2.3 --- PyIUnknown.cpp 26 Nov 2008 07:17:39 -0000 1.12.2.4 *************** *** 209,213 **** return NULL; ! IID useIID; /* used if obUseIID != NULL */ // This used to allow an int, with 1 indicating IUnknown --- 209,213 ---- return NULL; ! IID useIID; /* used if obUseIID != Py_None */ // This used to allow an int, with 1 indicating IUnknown *************** *** 236,240 **** /* we may have been asked to use a different interface */ ! /* ??? useIID will be ignored if interface successfully created ??? */ if ( rc == NULL && obUseIID != Py_None) { --- 236,242 ---- /* we may have been asked to use a different interface */ ! /* ??? useIID will be ignored if interface successfully created ??? ! Apparently true and relies on a final QI somewhere? :() ! */ if ( rc == NULL && obUseIID != Py_None) { Index: PyIDispatch.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/PyIDispatch.cpp,v retrieving revision 1.11.4.1 retrieving revision 1.11.4.2 diff -C2 -d -r1.11.4.1 -r1.11.4.2 *** PyIDispatch.cpp 29 Aug 2008 08:27:37 -0000 1.11.4.1 --- PyIDispatch.cpp 26 Nov 2008 07:17:39 -0000 1.11.4.2 *************** *** 60,64 **** return PyErr_Format(PyExc_TypeError, "At least one argument must be supplied"); ! LCID lcid; UINT offset = 0; if ( argc > 1 ){ --- 60,64 ---- return PyErr_Format(PyExc_TypeError, "At least one argument must be supplied"); ! LCID lcid = LOCALE_SYSTEM_DEFAULT; UINT offset = 0; if ( argc > 1 ){ |
From: Mark H. <mha...@us...> - 2008-11-26 07:17:43
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/mfc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14888/Pythonwin/pywin/mfc Modified Files: Tag: py3k activex.py dialog.py window.py Log Message: Merge various changes from trunk and py3k-integration bzr branch Index: window.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/mfc/window.py,v retrieving revision 1.2.4.1 retrieving revision 1.2.4.2 diff -C2 -d -r1.2.4.1 -r1.2.4.2 *** window.py 29 Aug 2008 06:16:42 -0000 1.2.4.1 --- window.py 26 Nov 2008 07:17:39 -0000 1.2.4.2 *************** *** 1,2 **** --- 1,3 ---- + # The MFCish window classes. from . import object import win32ui Index: activex.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/mfc/activex.py,v retrieving revision 1.3.4.1 retrieving revision 1.3.4.2 diff -C2 -d -r1.3.4.1 -r1.3.4.2 *** activex.py 29 Aug 2008 06:16:42 -0000 1.3.4.1 --- activex.py 26 Nov 2008 07:17:38 -0000 1.3.4.2 *************** *** 29,33 **** def HookOleEvents(self): dict = self._GetEventMap() ! for dispid, methodName in list(dict.items()): if hasattr(self, methodName): self._obj_.HookOleEvent( getattr(self, methodName), dispid ) --- 29,33 ---- def HookOleEvents(self): dict = self._GetEventMap() ! for dispid, methodName in dict.iteritems(): if hasattr(self, methodName): self._obj_.HookOleEvent( getattr(self, methodName), dispid ) Index: dialog.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/mfc/dialog.py,v retrieving revision 1.3.4.1 retrieving revision 1.3.4.2 diff -C2 -d -r1.3.4.1 -r1.3.4.2 *** dialog.py 29 Aug 2008 06:16:42 -0000 1.3.4.1 --- dialog.py 26 Nov 2008 07:17:39 -0000 1.3.4.2 *************** *** 7,11 **** import win32ui import win32con ! from . import window def dllFromDll(dllid): --- 7,12 ---- import win32ui import win32con ! # sob - 2to3 doesn't see this as a relative import :( ! from pywin.mfc import window def dllFromDll(dllid): *************** *** 61,65 **** # Make a dialog object look like a dictionary for the DDX support def __bool__(self): ! return 1 def __len__(self): return len(self.data) def __getitem__(self, key): return self.data[key] --- 62,66 ---- # Make a dialog object look like a dictionary for the DDX support def __bool__(self): ! return True def __len__(self): return len(self.data) def __getitem__(self, key): return self.data[key] |
From: Mark H. <mha...@us...> - 2008-11-26 06:47:49
|
Update of /cvsroot/pywin32/pywin32 In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13220 Modified Files: Tag: py3k ToDo.txt Log Message: add comment. Index: ToDo.txt =================================================================== RCS file: /cvsroot/pywin32/pywin32/Attic/ToDo.txt,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -C2 -d -r1.1.2.7 -r1.1.2.8 *** ToDo.txt 16 Sep 2008 01:07:20 -0000 1.1.2.7 --- ToDo.txt 26 Nov 2008 06:47:43 -0000 1.1.2.8 *************** *** 10,17 **** Pythonwin - xxx LVITEM and TVITEM conversions use PyWinobject_AsTCHAR, result needs to be freed ! xxx LV_COLUMN conversion - same as above xxx win32uimodule - Python_callback has 64-bit issues with HWND, WPARAM, LPARAM xxx win32util.cpp - GetReprText needs fixes for Py3k unicode repr --- 10,19 ---- Pythonwin - xxx LVITEM and TVITEM conversions use PyWinobject_AsTCHAR, result needs to be freed ! LV_COLUMN conversion - same as above xxx win32uimodule - Python_callback has 64-bit issues with HWND, WPARAM, LPARAM + [markh - the above pythonwin issues all seem done?] + xxx win32util.cpp - GetReprText needs fixes for Py3k unicode repr |
From: Mark H. <mha...@us...> - 2008-11-26 02:17:48
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/debugger In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14116/pywin/debugger Modified Files: debugger.py Log Message: various py3k syntax modernizations Index: debugger.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/debugger/debugger.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** debugger.py 14 Nov 2008 00:22:25 -0000 1.21 --- debugger.py 26 Nov 2008 01:30:11 -0000 1.22 *************** *** 31,38 **** from dbgcon import * ! class DebuggerException(Exception): ! """A Pythonwin debugger exception""" ! ! error = DebuggerException def SetInteractiveContext(globs, locs): --- 31,35 ---- from dbgcon import * ! error = "pywin.debugger.error" def SetInteractiveContext(globs, locs): |
From: Mark H. <mha...@us...> - 2008-11-26 02:17:42
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/ocx In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14116/pywin/Demos/ocx Modified Files: ocxserialtest.py Log Message: various py3k syntax modernizations Index: ocxserialtest.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/Demos/ocx/ocxserialtest.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ocxserialtest.py 23 Oct 2008 05:22:38 -0000 1.3 --- ocxserialtest.py 26 Nov 2008 01:30:11 -0000 1.4 *************** *** 89,93 **** self.olectl.PortOpen = 0 except pythoncom.com_error, details: ! print "Error closing port - %s" % (details[2][2]) return dialog.Dialog.OnDestroy(self, msg) --- 89,93 ---- self.olectl.PortOpen = 0 except pythoncom.com_error, details: ! print "Error closing port - %s" % (details.excepinfo[2]) return dialog.Dialog.OnDestroy(self, msg) |
From: Mark H. <mha...@us...> - 2008-11-26 02:17:33
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14615/pywin/idle Modified Files: AutoIndent.py Log Message: ensure our readlines methods used by our plugins always return bytes on py3k Index: AutoIndent.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/idle/AutoIndent.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AutoIndent.py 1 Oct 2008 14:44:52 -0000 1.4 --- AutoIndent.py 26 Nov 2008 01:32:59 -0000 1.5 *************** *** 517,526 **** def readline(self): if self.finished: ! return "" ! i = self.i = self.i + 1 ! mark = `i` + ".0" ! if self.text.compare(mark, ">=", "end"): ! return "" ! return self.text.get(mark, mark + " lineend+1c") def tokeneater(self, type, token, start, end, line, --- 517,529 ---- def readline(self): if self.finished: ! val = "" ! else: ! i = self.i = self.i + 1 ! mark = repr(i) + ".0" ! if self.text.compare(mark, ">=", "end"): ! val = "" ! else: ! val = self.text.get(mark, mark + " lineend+1c") ! return val.encode(default_scintilla_encoding) def tokeneater(self, type, token, start, end, line, |
From: Mark H. <mha...@us...> - 2008-11-26 02:17:29
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/mfc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14116/pywin/mfc Modified Files: dialog.py Log Message: various py3k syntax modernizations Index: dialog.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/mfc/dialog.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** dialog.py 23 Oct 2008 07:39:12 -0000 1.5 --- dialog.py 26 Nov 2008 01:30:11 -0000 1.6 *************** *** 7,11 **** import win32ui import win32con ! import window def dllFromDll(dllid): --- 7,12 ---- import win32ui import win32con ! # sob - 2to3 doesn't see this as a relative import :( ! from pywin.mfc import window def dllFromDll(dllid): |
From: Mark H. <mha...@us...> - 2008-11-26 02:17:25
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14615/pywin/scintilla Modified Files: IDLEenvironment.py Log Message: ensure our readlines methods used by our plugins always return bytes on py3k Index: IDLEenvironment.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/scintilla/IDLEenvironment.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** IDLEenvironment.py 14 Nov 2008 00:22:25 -0000 1.12 --- IDLEenvironment.py 26 Nov 2008 01:32:59 -0000 1.13 *************** *** 43,55 **** def fast_readline(self): if self.finished: ! return "" ! if "_scint_lines" not in self.__dict__: ! # XXX - note - assumes this is only called once the file is loaded! ! self._scint_lines = self.text.edit.GetTextRange().split("\n") ! sl = self._scint_lines ! i = self.i = self.i + 1 ! if i >= len(sl): ! return "" ! return (sl[i]+"\n").encode(default_scintilla_encoding) try: --- 43,58 ---- def fast_readline(self): if self.finished: ! val = "" ! else: ! if "_scint_lines" not in self.__dict__: ! # XXX - note - assumes this is only called once the file is loaded! ! self._scint_lines = self.text.edit.GetTextRange().split("\n") ! sl = self._scint_lines ! i = self.i = self.i + 1 ! if i >= len(sl): ! val = "" ! else: ! val = sl[i]+"\n" ! return val.encode(default_scintilla_encoding) try: |
From: Mark H. <mha...@us...> - 2008-11-26 02:17:17
|
Update of /cvsroot/pywin32/pywin32/com/win32com/client In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15233/com/win32com/client Modified Files: dynamic.py Log Message: minor tweaks for working with py3k Index: dynamic.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/dynamic.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** dynamic.py 11 Nov 2008 00:56:06 -0000 1.24 --- dynamic.py 26 Nov 2008 01:38:42 -0000 1.25 *************** *** 16,19 **** --- 16,20 ---- """ + import sys import traceback import types *************** *** 63,66 **** --- 64,74 ---- print + # A helper to create method objects on the fly + if sys.version_info > (3,0): + def MakeMethod(func, inst, cls): + return types.MethodType(func, inst) # class not needed in py3k + else: + MakeMethod = types.MethodType # all args used in py2k. + # get the type objects for IDispatch and IUnknown dispatchType = pythoncom.TypeIIDs[pythoncom.IID_IDispatch] *************** *** 172,176 **** def __nonzero__(self): ! return 1 # ie "if object:" should always be "true" - without this, __len__ is tried. # _Possibly_ want to defer to __len__ if available, but Im not sure this is # desirable??? --- 180,184 ---- def __nonzero__(self): ! return True # ie "if object:" should always be "true" - without this, __len__ is tried. # _Possibly_ want to defer to __len__ if available, but Im not sure this is # desirable??? *************** *** 306,310 **** # Save the function in map. fn = self._builtMethods_[name] = tempNameSpace[name] ! newMeth = types.MethodType(fn, self, self.__class__) return newMeth except: --- 314,318 ---- # Save the function in map. fn = self._builtMethods_[name] = tempNameSpace[name] ! newMeth = MakeMethod(fn, self, self.__class__) return newMeth except: *************** *** 440,444 **** # If a known method, create new instance and return. try: ! return types.MethodType(self._builtMethods_[attr], self, self.__class__) except KeyError: pass --- 448,452 ---- # If a known method, create new instance and return. try: ! return MakeMethod(self._builtMethods_[attr], self, self.__class__) except KeyError: pass |
From: Mark H. <mha...@us...> - 2008-11-26 02:17:02
|
Update of /cvsroot/pywin32/pywin32/com/win32com/client In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16123 Modified Files: genpy.py makepy.py Log Message: rationalize the 2 places where we opened files for writing to automatically do the .temp and encoding thing, plus other py3k friendly changes. Index: genpy.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/genpy.py,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** genpy.py 14 Nov 2008 00:22:25 -0000 1.56 --- genpy.py 26 Nov 2008 01:46:30 -0000 1.57 *************** *** 98,101 **** --- 98,102 ---- # classes. class WritableItem: + # __cmp__ used for sorting in py2x... def __cmp__(self, other): "Compare for sorting" *************** *** 103,106 **** --- 104,112 ---- if ret==0 and self.doc: ret = cmp(self.doc[0], other.doc[0]) return ret + # ... but not used in py3k - __lt__ minimum needed there + def __lt__(self, other): # py3k variant + if self.order == other.order: + return self.doc < other.doc + return self.order < other.order def __repr__(self): return "OleItem: doc=%s, order=%d" % (repr(self.doc), self.order) *************** *** 205,209 **** if vdesc[4] == pythoncom.VAR_CONST: val = vdesc[1] ! if type(val) in (type(0), type(0L)): if val==0x80000000L: # special case use = "0x80000000L" # 'L' for future warning --- 211,215 ---- if vdesc[4] == pythoncom.VAR_CONST: val = vdesc[1] ! if sys.version_info <= (2,4) and (isinstance(val, int) or isinstance(val, long)): if val==0x80000000L: # special case use = "0x80000000L" # 'L' for future warning *************** *** 360,364 **** stream = generator.file # Write in alpha order. ! names = self.mapFuncs.keys() names.sort() specialItems = {"count":None, "item":None,"value":None,"_newenum":None} # If found, will end up with (entry, invoke_tupe) --- 366,370 ---- stream = generator.file # Write in alpha order. ! names = list(self.mapFuncs.keys()) names.sort() specialItems = {"count":None, "item":None,"value":None,"_newenum":None} # If found, will end up with (entry, invoke_tupe) *************** *** 761,764 **** --- 767,797 ---- return oleItems, enumItems, recordItems, vtableItems + def open_writer(self, filename, encoding="mbcs"): + # A place to put code to open a file with the appropriate encoding. + # Does *not* set self.file - just opens and returns a file. + # Actually *deletes* the filename asked for and returns a handle to a + # temp file - finish_writer then puts everything back in place. This + # is so errors don't leave a 1/2 generated file around causing bizarre + # errors later. + # Could be a classmethod one day... + try: + os.unlink(filename) + except os.error: + pass + filename = filename + ".temp" + if sys.version_info > (3,0): + ret = open(filename, "wt", encoding=encoding) + else: + import codecs # not available in py3k. + ret = codecs.open(filename, "wt", encoding) + return ret + + def finish_writer(self, filename, f, worked): + f.close() + if worked: + os.rename(filename + ".temp", filename) + else: + os.unlink(filename + ".temp") + def generate(self, file, is_for_demand = 0): if is_for_demand: *************** *** 782,786 **** self.bHaveWrittenCoClassBaseClass = 0 self.bHaveWrittenEventBaseClass = 0 ! encoding = self.file.encoding or "mbcs" print >> self.file, '# -*- coding: %s -*-' % (encoding,) --- 815,823 ---- self.bHaveWrittenCoClassBaseClass = 0 self.bHaveWrittenEventBaseClass = 0 ! # You must provide a file correctly configured for writing unicode. ! # We assert this is it may indicate somewhere in pywin32 that needs ! # upgrading. ! assert self.file.encoding, self.file ! encoding = self.file.encoding # or "mbcs" print >> self.file, '# -*- coding: %s -*-' % (encoding,) *************** *** 795,802 **** print >> self.file, 'makepy_version =', `makepy_version` ! try: ! print >> self.file, 'python_version = 0x%x' % (sys.hexversion,) ! except AttributeError: ! print >> self.file, 'python_version = 0x0 # Presumably Python 1.5.2 - 0x0 is not a problem' print >> self.file print >> self.file, 'import win32com.client.CLSIDToClass, pythoncom' --- 832,836 ---- print >> self.file, 'makepy_version =', `makepy_version` ! print >> self.file, 'python_version = 0x%x' % (sys.hexversion,) print >> self.file print >> self.file, 'import win32com.client.CLSIDToClass, pythoncom' *************** *** 836,842 **** if enumItems: print >> stream, "class constants:" ! list = enumItems.values() ! list.sort() ! for oleitem in list: oleitem.WriteEnumerationItems(stream) self.progress.Tick() --- 870,876 ---- if enumItems: print >> stream, "class constants:" ! items = enumItems.values() ! items.sort() ! for oleitem in items: oleitem.WriteEnumerationItems(stream) self.progress.Tick() *************** *** 844,857 **** if self.generate_type == GEN_FULL: ! list = oleItems.values() ! list = filter(lambda l: l is not None, list) ! list.sort() ! for oleitem in list: self.progress.Tick() oleitem.WriteClass(self) ! list = vtableItems.values() ! list.sort() ! for oleitem in list: self.progress.Tick() oleitem.WriteClass(self) --- 878,891 ---- if self.generate_type == GEN_FULL: ! items = oleItems.values() ! items = [l for l in items if l is not None] ! items.sort() ! for oleitem in items: self.progress.Tick() oleitem.WriteClass(self) ! items = vtableItems.values() ! items.sort() ! for oleitem in items: self.progress.Tick() oleitem.WriteClass(self) *************** *** 860,865 **** print >> stream, 'RecordMap = {' ! list = recordItems.values() ! for record in list: if str(record.clsid) == pythoncom.IID_NULL: print >> stream, "\t###%s: %s, # Typedef disabled because it doesn't have a non-null GUID" % (`record.doc[0]`, `str(record.clsid)`) --- 894,898 ---- print >> stream, 'RecordMap = {' ! for record in recordItems.itervalues(): if str(record.clsid) == pythoncom.IID_NULL: print >> stream, "\t###%s: %s, # Typedef disabled because it doesn't have a non-null GUID" % (`record.doc[0]`, `str(record.clsid)`) *************** *** 981,985 **** an_item = oleitem or vtableitem assert not self.file, "already have a file?" ! self.file = open(os.path.join(dir, an_item.python_name) + ".py", "w") try: if oleitem is not None: --- 1014,1022 ---- an_item = oleitem or vtableitem assert not self.file, "already have a file?" ! # like makepy.py, we gen to a .temp file so failure doesn't ! # leave a 1/2 generated mess. ! out_name = os.path.join(dir, an_item.python_name) + ".py" ! worked = False ! self.file = self.open_writer(out_name) try: if oleitem is not None: *************** *** 988,993 **** self.do_gen_child_item(vtableitem) self.progress.Tick() finally: ! self.file.close() self.file = None finally: --- 1025,1031 ---- self.do_gen_child_item(vtableitem) self.progress.Tick() + worked = True finally: ! self.finish_writer(out_name, self.file, worked) self.file = None finally: Index: makepy.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/client/makepy.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** makepy.py 14 Nov 2008 00:22:25 -0000 1.26 --- makepy.py 26 Nov 2008 01:46:30 -0000 1.27 *************** *** 67,74 **** """ ! import genpy, string, sys, os, types, pythoncom ! import codecs ! import selecttlb ! import gencache from win32com.client import NeedUnicodeConversions, Dispatch --- 67,72 ---- """ ! import sys, os, pythoncom ! from win32com.client import genpy, selecttlb, gencache from win32com.client import NeedUnicodeConversions, Dispatch *************** *** 254,257 **** --- 252,257 ---- for typelib, info in typelibs: + gen = genpy.Generator(typelib, info.dll, progress, bUnicodeToString=bUnicodeToString, bBuildHidden=bBuildHidden) + if file is None: this_name = gencache.GetGeneratedFileName(info.clsid, info.lcid, info.major, info.minor) *************** *** 269,292 **** else: outputName = full_name + ".py" ! # generate to a temp file (so errors don't leave a 1/2 ! # generated file) and one which can handle unicode! ! try: ! os.unlink(outputName) ! except os.error: ! pass ! encoding = 'mbcs' # could make this a param. ! fileUse = codecs.open(outputName + ".temp", "wt", ! encoding) progress.LogBeginGenerate(outputName) else: fileUse = file ! gen = genpy.Generator(typelib, info.dll, progress, bUnicodeToString=bUnicodeToString, bBuildHidden=bBuildHidden) ! ! gen.generate(fileUse, bForDemand) ! ! if file is None: ! fileUse.close() ! os.rename(outputName + ".temp", outputName) if bToGenDir: progress.SetDescription("Importing module") --- 269,284 ---- else: outputName = full_name + ".py" ! fileUse = gen.open_writer(outputName) progress.LogBeginGenerate(outputName) else: fileUse = file ! worked = False ! try: ! gen.generate(fileUse, bForDemand) ! worked = True ! finally: ! if file is None: ! gen.finish_writer(outputName, fileUse, worked) if bToGenDir: progress.SetDescription("Importing module") |
From: Mark H. <mha...@us...> - 2008-11-26 02:16:58
|
Update of /cvsroot/pywin32/pywin32/com/win32com/demos In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16313/com/win32com/demos Modified Files: connect.py Log Message: modernize syntax for py3k Index: connect.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/demos/connect.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** connect.py 9 Nov 2003 11:01:18 -0000 1.2 --- connect.py 26 Nov 2008 01:47:26 -0000 1.3 *************** *** 73,77 **** CheckEvent(server, client, "Here is a null>"+chr(0)+"<", verbose) CheckEvent(server, client, u"Here is a null>"+unichr(0)+"<", verbose) ! val = unicode("test-\xe0\xf2", "latin-1") # 2 latin characters. CheckEvent(server, client, val, verbose) if verbose: --- 73,77 ---- CheckEvent(server, client, "Here is a null>"+chr(0)+"<", verbose) CheckEvent(server, client, u"Here is a null>"+unichr(0)+"<", verbose) ! val = u"test-\xe0\xf2" # 2 extended characters. CheckEvent(server, client, val, verbose) if verbose: |
From: Mark H. <mha...@us...> - 2008-11-26 02:16:53
|
Update of /cvsroot/pywin32/pywin32/com/win32com/server In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16564/com/win32com/server Modified Files: policy.py Log Message: Get rid of use of string module and other py3k friendly changes. Index: policy.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/server/policy.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** policy.py 13 Feb 2008 22:18:08 -0000 1.23 --- policy.py 26 Nov 2008 01:48:48 -0000 1.24 *************** *** 71,77 **** import win32api import winerror - import string import sys import types import win32con, pythoncom --- 71,77 ---- import win32api import winerror import sys import types + import pywintypes import win32con, pythoncom *************** *** 85,92 **** # Few more globals to speed things. - from pywintypes import UnicodeType IDispatchType = pythoncom.TypeIIDs[pythoncom.IID_IDispatch] IUnknownType = pythoncom.TypeIIDs[pythoncom.IID_IUnknown] - core_has_unicode = hasattr(__builtins__, "unicode") from exception import COMException --- 85,90 ---- *************** *** 98,104 **** regAddnPath = 'CLSID\\%s\\PythonCOMPath' - # exc_info doesnt appear 'till Python 1.5, but we now have other 1.5 deps! - from sys import exc_info - def CreateInstance(clsid, reqIID): """Create a new instance of the specified IID --- 96,99 ---- *************** *** 114,119 **** # First see is sys.path should have something on it. try: ! addnPaths = string.split(win32api.RegQueryValue(win32con.HKEY_CLASSES_ROOT, ! regAddnPath % clsid),';') for newPath in addnPaths: if newPath not in sys.path: --- 109,114 ---- # First see is sys.path should have something on it. try: ! addnPaths = win32api.RegQueryValue(win32con.HKEY_CLASSES_ROOT, ! regAddnPath % clsid).split(';') for newPath in addnPaths: if newPath not in sys.path: *************** *** 134,140 **** except win32api.error: dispatcher = None - - # clear exception information - sys.exc_type = sys.exc_value = sys.exc_traceback = None # sys.clearexc() appears in 1.5? if dispatcher: --- 129,132 ---- *************** *** 242,246 **** # Allow interfaces to be specified by name. for i in ob._com_interfaces_: ! if type(i) != pythoncom.PyIIDType: # Prolly a string! if i[0] != "{": --- 234,238 ---- # Allow interfaces to be specified by name. for i in ob._com_interfaces_: ! if type(i) != pywintypes.IIDType: # Prolly a string! if i[0] != "{": *************** *** 280,284 **** if type(dispid) == type(""): try: ! dispid = self._name_to_dispid_[string.lower(dispid)] except KeyError: raise COMException(scode = winerror.DISP_E_MEMBERNOTFOUND, desc="Member not found") --- 272,276 ---- if type(dispid) == type(""): try: ! dispid = self._name_to_dispid_[dispid.lower()] except KeyError: raise COMException(scode = winerror.DISP_E_MEMBERNOTFOUND, desc="Member not found") *************** *** 314,318 **** try: ### TODO - look at the fdex flags!!! ! return self._name_to_dispid_[string.lower(str(name))] except KeyError: raise COMException(scode = winerror.DISP_E_UNKNOWNNAME) --- 306,310 ---- try: ### TODO - look at the fdex flags!!! ! return self._name_to_dispid_[name.lower()] except KeyError: raise COMException(scode = winerror.DISP_E_UNKNOWNNAME) *************** *** 327,331 **** if type(dispid) == type(""): try: ! dispid = self._name_to_dispid_[string.lower(dispid)] except KeyError: raise COMException(scode = winerror.DISP_E_MEMBERNOTFOUND, desc="Member not found") --- 319,323 ---- if type(dispid) == type(""): try: ! dispid = self._name_to_dispid_[dispid.lower()] except KeyError: raise COMException(scode = winerror.DISP_E_MEMBERNOTFOUND, desc="Member not found") *************** *** 470,474 **** # Filter out all 'normal' IIDs (ie, IID objects and strings starting with { interfaces = [i for i in getattr(ob, '_com_interfaces_', []) ! if type(i) != pythoncom.PyIIDType and not i.startswith("{")] universal_data = universal.RegisterInterfaces(tlb_guid, tlb_lcid, tlb_major, tlb_minor, interfaces) --- 462,466 ---- # Filter out all 'normal' IIDs (ie, IID objects and strings starting with { interfaces = [i for i in getattr(ob, '_com_interfaces_', []) ! if type(i) != pywintypes.IIDType and not i.startswith("{")] universal_data = universal.RegisterInterfaces(tlb_guid, tlb_lcid, tlb_major, tlb_minor, interfaces) *************** *** 481,493 **** # Copy existing _dispid_to_func_ entries to _name_to_dispid_ for dispid, name in self._dispid_to_func_.items(): ! self._name_to_dispid_[string.lower(name)]=dispid for dispid, name in self._dispid_to_get_.items(): ! self._name_to_dispid_[string.lower(name)]=dispid for dispid, name in self._dispid_to_put_.items(): ! self._name_to_dispid_[string.lower(name)]=dispid # Patch up the universal stuff. for dispid, invkind, name in universal_data: ! self._name_to_dispid_[string.lower(name)]=dispid if invkind == DISPATCH_METHOD: self._dispid_to_func_[dispid] = name --- 473,485 ---- # Copy existing _dispid_to_func_ entries to _name_to_dispid_ for dispid, name in self._dispid_to_func_.items(): ! self._name_to_dispid_[name.lower()]=dispid for dispid, name in self._dispid_to_get_.items(): ! self._name_to_dispid_[name.lower()]=dispid for dispid, name in self._dispid_to_put_.items(): ! self._name_to_dispid_[name.lower()]=dispid # Patch up the universal stuff. for dispid, invkind, name in universal_data: ! self._name_to_dispid_[name.lower()]=dispid if invkind == DISPATCH_METHOD: self._dispid_to_func_[dispid] = name *************** *** 650,655 **** except pythoncom.error: pass # Keep it as IUnknown - elif not core_has_unicode and arg_type==UnicodeType: - arg = str(arg) ret.append(arg) return tuple(ret), kwArgs --- 642,645 ---- *************** *** 685,690 **** def _getdispid_(self, name, fdex): # TODO - Look at fdex flags. ! # TODO - Remove str() of Unicode name param. ! lname = string.lower(str(name)) try: return self._name_to_dispid_[lname] --- 675,679 ---- def _getdispid_(self, name, fdex): # TODO - Look at fdex flags. ! lname = name.lower() try: return self._name_to_dispid_[lname] *************** *** 703,709 **** ### note: serviceProvider is being ignored... ### there might be assigned DISPID values to properties, too... - ### TODO - Remove the str() of the Unicode argument try: ! name = str(self._dyn_dispid_to_name_[dispid]) except KeyError: raise COMException(scode = winerror.DISP_E_MEMBERNOTFOUND, desc="Member not found") --- 692,697 ---- ### note: serviceProvider is being ignored... ### there might be assigned DISPID values to properties, too... try: ! name = self._dyn_dispid_to_name_[dispid] except KeyError: raise COMException(scode = winerror.DISP_E_MEMBERNOTFOUND, desc="Member not found") *************** *** 720,724 **** """ try: ! idx = string.rindex(spec, ".") mname = spec[:idx] fname = spec[idx+1:] --- 708,712 ---- """ try: ! idx = spec.rindex(".") mname = spec[:idx] fname = spec[idx+1:] |
From: Mark H. <mha...@us...> - 2008-11-26 02:16:48
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/axscript/client In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16635/com/win32comext/axscript/client Modified Files: error.py Log Message: 2to3-friendly change (rename local variable called 'list') and add comment about existing bogus utf8 encoding. Index: error.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/client/error.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** error.py 7 May 2007 02:27:44 -0000 1.9 --- error.py 26 Nov 2008 01:49:44 -0000 1.10 *************** *** 154,173 **** tb_top = tb ! list = ['Traceback (most recent call last):\n'] ! list = list + traceback.format_list(format_items) if exc_type==pythoncom.com_error: desc = "%s (0x%x)" % (value[1], value[0]) if value[0]==winerror.DISP_E_EXCEPTION and value[2] and value[2][2]: desc = value[2][2] ! list.append("COM Error: "+desc) else: ! list = list + traceback.format_exception_only(exc_type, value) # all items in the list are utf8 courtesy of Python magically # converting unicode to utf8 before compilation. ! for i in range(len(list)): ! if type(list[i]) is str: ! #assert type(list[i]) is str, type(list[i]) ! list[i] = list[i].decode('utf8') ! self.description = ExpandTabs(u''.join(list)) # Clear tracebacks etc. tb = tb_top = tb_look = None --- 154,186 ---- tb_top = tb ! bits = ['Traceback (most recent call last):\n'] ! bits.extend(traceback.format_list(format_items)) if exc_type==pythoncom.com_error: desc = "%s (0x%x)" % (value[1], value[0]) if value[0]==winerror.DISP_E_EXCEPTION and value[2] and value[2][2]: desc = value[2][2] ! bits.append("COM Error: "+desc) else: ! bits.extend(traceback.format_exception_only(exc_type, value)) ! ! # XXX - this block appears completely bogus??? The UTF8 ! # comment below is from well before py3k, so utf8 doesn't have ! # any special status in py2k. Most likely is that this was ! # simply an artifact of an invalid test (which remains - it ! # raises a RuntimeError with a *string* with extended ! # characters.) ! # Sadly, the test still fails in the same way if you raise a ! # Unicode string with an extended char. This block keeps the ! # tests passing, so it remains. ! # XXX - todo - read the above, and fix below! ! # all items in the list are utf8 courtesy of Python magically # converting unicode to utf8 before compilation. ! for i in xrange(len(bits)): ! if type(bits[i]) is str: ! #assert type(bits[i]) is str, type(bits[i]) ! bits[i] = bits[i].decode('utf8') ! ! self.description = ExpandTabs(u''.join(bits)) # Clear tracebacks etc. tb = tb_top = tb_look = None |
From: Mark H. <mha...@us...> - 2008-11-26 02:16:44
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/axscript/client In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16751/com/win32comext/axscript/client Modified Files: pyscript.py Log Message: Remove use of rexec module - its been disabled for years! Index: pyscript.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/client/pyscript.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pyscript.py 6 May 2007 12:03:51 -0000 1.11 --- pyscript.py 26 Nov 2008 01:50:18 -0000 1.12 *************** *** 8,25 **** """ - import framework import winerror import win32com import win32api import pythoncom - from win32com.axscript import axscript - import win32com.server.register import sys import traceback - import scriptdispatch import re import win32com.client.dynamic ! from framework import RaiseAssert, trace, Exception, SCRIPTTEXT_FORCEEXECUTION, SCRIPTTEXT_ISEXPRESSION, SCRIPTTEXT_ISPERSISTENT PyScript_CLSID = "{DF630910-1C1D-11d0-AE36-8C0F5E000000}" --- 8,26 ---- """ import winerror import win32com import win32api import pythoncom import sys import traceback import re import win32com.client.dynamic + from win32com.axscript.client import framework, scriptdispatch + from win32com.axscript import axscript + import win32com.server.register ! from win32com.axscript.client.framework import \ ! RaiseAssert, trace, Exception, SCRIPTTEXT_FORCEEXECUTION, \ ! SCRIPTTEXT_ISEXPRESSION, SCRIPTTEXT_ISPERSISTENT PyScript_CLSID = "{DF630910-1C1D-11d0-AE36-8C0F5E000000}" *************** *** 41,82 **** return "PyScript - " + framework.AXScriptCodeBlock.GetDisplayName(self) - # - # Restricted execution model. - # - import rexec - class AXRExec(rexec.RExec): - ok_builtin_modules = rexec.RExec.ok_builtin_modules + ('win32trace',) - - def __init__(self, pretendMain, hooks = None, verbose = 0): - self.pretendMain = pretendMain - rexec.RExec.__init__(self, hooks, verbose) - # mods = list(self.ok_dynamic_modules) - # mods.append("win32trace") - # mods = tuple(mods) - # self.ok_dynamic_modules = mods - def make_main(self): - if not self.modules.has_key('__main__'): - self.modules['__main__'] = self.pretendMain - self.pretendMain.__builtins__ = self.modules['__builtin__'] - m = self.add_module('__main__') - - # Classes that looks and behaves like RExec, but isnt really! - import ihooks - class AXNotRHooks(ihooks.Hooks): - pass - - class AXNotRExec: - def __init__(self, pretendMain, hooks = None, verbose = 0): - self.pretendMain = pretendMain - self.hooks = hooks or AXNotRHooks(verbose) - self.modules = {'__main__': self.pretendMain} - - def add_module(self, mname): - if self.modules.has_key(mname): - return self.modules[mname] - self.modules[mname] = m = self.hooks.new_module(mname) - # m.__builtins__ = self.modules['__builtin__'] - return m - # There is only ever _one_ ax object - it exists in the global namespace # for all script items. --- 42,45 ---- *************** *** 224,228 **** self.globalNameSpaceModule = imp.new_module("__ax_main__") self.globalNameSpaceModule.__dict__['ax'] = AXScriptAttribute(self) - self.rexec_env = None # will be created first time around. self.codeBlocks = [] --- 187,190 ---- *************** *** 252,266 **** def RegisterNamedItem(self, item): - if self.rexec_env is None: - # RExec is not available in 2.2+. If we get here for IE, the - # user has explicitly run axscript_rexec, so is choosing to - # take this risk. - # if self.safetyOptions & (axscript.INTERFACESAFE_FOR_UNTRUSTED_DATA | axscript.INTERFACESAFE_FOR_UNTRUSTED_CALLER): - # # Use RExec. - # self.rexec_env = AXRExec(self.globalNameSpaceModule) - # else: - # DONT use RExec. - self.rexec_env = AXNotRExec(self.globalNameSpaceModule) - wasReg = item.isRegistered framework.COMScript.RegisterNamedItem(self, item) --- 214,217 ---- *************** *** 401,406 **** pass # ??? globalNameSpaceModule = None - - self.rexec_env = None def DllRegisterServer(): --- 352,355 ---- |
From: Mark H. <mha...@us...> - 2008-11-26 02:16:40
|
Update of /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14284/pywin/framework Modified Files: stdin.py Log Message: Cleanup old strange code that attempted to (poorly) delegate to another file object when closed! This fixes py3k where the real sys.stdin is actually None in a GUI. Index: stdin.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/pywin/framework/stdin.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** stdin.py 14 Nov 2008 00:22:25 -0000 1.5 --- stdin.py 26 Nov 2008 01:32:08 -0000 1.6 *************** *** 18,25 **** """ import sys - import string - true = 1 - false = 0 try: get_input_line = raw_input # py2x --- 18,22 ---- *************** *** 29,38 **** class Stdin: def __init__(self): ! self.real_file = sys.stdin self.buffer = "" def __getattr__(self, name): """Forward most functions to the real sys.stdin for absolute realism. """ return getattr(self.real_file, name) --- 26,38 ---- class Stdin: def __init__(self): ! self.real_file = sys.stdin # NOTE: Likely to be None in py3k self.buffer = "" + self.closed = False def __getattr__(self, name): """Forward most functions to the real sys.stdin for absolute realism. """ + if self.real_file is None: + raise AttributeError, name return getattr(self.real_file, name) *************** *** 50,59 **** EOF is encountered immediately. (For certain files, like ttys, it makes sense to continue reading after an EOF is hit.)""" - if self.closed: - return self.real_file.read(size) - result_size = self.__get_lines(size) return self.__extract_from_buffer(result_size) - def readline(self, size = -1): --- 50,55 ---- *************** *** 67,73 **** in the input. """ - if self.closed: - return self.real_file.readline(size) - maximum_result_size = self.__get_lines(size, lambda buffer: '\n' in buffer) --- 63,66 ---- *************** *** 88,92 **** return result ! def __get_lines(self, desired_size, done_reading = lambda buffer: false): """Keep adding lines to our internal buffer until done_reading(self.buffer) is true or EOF has been reached or we have desired_size bytes in the buffer. --- 81,85 ---- return result ! def __get_lines(self, desired_size, done_reading = lambda buffer: False): """Keep adding lines to our internal buffer until done_reading(self.buffer) is true or EOF has been reached or we have desired_size bytes in the buffer. *************** *** 101,107 **** try: self.__get_line() ! except: # deal with cancellation of get_input_line dialog desired_size = len(self.buffer) # Be satisfied! ! pass if desired_size < 0: return len(self.buffer) --- 94,100 ---- try: self.__get_line() ! except EOFError: # deal with cancellation of get_input_line dialog desired_size = len(self.buffer) # Be satisfied! ! if desired_size < 0: return len(self.buffer) *************** *** 122,128 **** (possibly after rounding up to an internal buffer size) are read. """ - if self.closed: - return self.real_file.readlines(*sizehint) - result = [] total_read = 0 --- 115,118 ---- |
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13930 Modified Files: testDictionary.py testExplorer.py testMSOffice.py testPyComTest.py testShell.py testall.py testvb.py util.py Log Message: Improvements to the test registration process and add the concept of a test being "skipped" due to the lack of testable COM object - vastly reduces test noise due to non-existing test objects. Index: testPyComTest.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testPyComTest.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** testPyComTest.py 24 Nov 2008 22:21:48 -0000 1.33 --- testPyComTest.py 26 Nov 2008 01:27:40 -0000 1.34 *************** *** 16,20 **** # This test uses a Python implemented COM server - ensure correctly registered. RegisterPythonServer(os.path.join(os.path.dirname(__file__), '..', "servers", "test_pycomtest.py"), ! "PyCOMTest.PyCOMTest") from win32com.client import gencache --- 16,20 ---- # This test uses a Python implemented COM server - ensure correctly registered. RegisterPythonServer(os.path.join(os.path.dirname(__file__), '..', "servers", "test_pycomtest.py"), ! "Python.Test.PyCOMTest") from win32com.client import gencache Index: util.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/util.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** util.py 24 Nov 2008 22:21:48 -0000 1.11 --- util.py 26 Nov 2008 01:27:40 -0000 1.12 *************** *** 15,19 **** # Ensure no lingering exceptions - Python should have zero outstanding # COM objects ! sys.exc_clear() c = _GetInterfaceCount() if c: --- 15,22 ---- # Ensure no lingering exceptions - Python should have zero outstanding # COM objects ! try: ! sys.exc_clear() ! except AttributeError: ! pass # py3k c = _GetInterfaceCount() if c: *************** *** 39,43 **** # have a CLSID - open it. try: ! hk = _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT, "CLSID\\%s" % clsid) dll = _winreg.QueryValue(hk, "InprocServer32") except WindowsError: --- 42,47 ---- # have a CLSID - open it. try: ! HKCR = _winreg.HKEY_CLASSES_ROOT ! hk = _winreg.OpenKey(HKCR, "CLSID\\%s" % clsid) dll = _winreg.QueryValue(hk, "InprocServer32") except WindowsError: *************** *** 66,70 **** if why_not: msg += "\n(registration check failed as %s)" % why_not ! raise RuntimeError(msg) # so theoretically we are able to register it. cmd = '%s "%s" --unattended > nul 2>&1' % (win32api.GetModuleFileName(0), filename) --- 70,76 ---- if why_not: msg += "\n(registration check failed as %s)" % why_not ! # throw a normal "class not registered" exception - we don't report ! # them the same way as "real" errors. ! raise pythoncom.com_error(winerror.CO_E_CLASSSTRING, msg, None, -1) # so theoretically we are able to register it. cmd = '%s "%s" --unattended > nul 2>&1' % (win32api.GetModuleFileName(0), filename) *************** *** 109,113 **** func(*args, **kw) except pythoncom.com_error, details: ! if details[0]==hresult: return testcase.fail("Excepected COM exception with HRESULT 0x%x" % hresult) --- 115,119 ---- func(*args, **kw) except pythoncom.com_error, details: ! if details.hresult==hresult: return testcase.fail("Excepected COM exception with HRESULT 0x%x" % hresult) *************** *** 221,224 **** --- 227,260 ---- return test + class TestResult(unittest._TextTestResult): + def __init__(self, *args, **kw): + super(TestResult, self).__init__(*args, **kw) + self.num_invalid_clsid = 0 + + def addError(self, test, err): + """Called when an error has occurred. 'err' is a tuple of values as + returned by sys.exc_info(). + """ + if isinstance(err[1], pythoncom.com_error) and \ + err[1].hresult==winerror.CO_E_CLASSSTRING: + self.num_invalid_clsid += 1 + if self.showAll: + self.stream.writeln("SKIP") + elif self.dots: + self.stream.write('S') + self.stream.flush() + return + super(TestResult, self).addError(test, err) + + def printErrors(self): + super(TestResult, self).printErrors() + if self.num_invalid_clsid: + self.stream.writeln("SKIPPED: %d tests due to missing COM objects used for testing" % + self.num_invalid_clsid) + + class TestRunner(unittest.TextTestRunner): + def _makeResult(self): + return TestResult(self.stream, self.descriptions, self.verbosity) + # Utilities to set the win32com logger to something what just captures # records written and doesn't print them. *************** *** 289,294 **** def testmain(*args, **kw): new_kw = kw.copy() ! if not new_kw.has_key('testLoader'): new_kw['testLoader'] = TestLoader() unittest.main(*args, **new_kw) CheckClean() --- 325,332 ---- def testmain(*args, **kw): new_kw = kw.copy() ! if 'testLoader' not in new_kw: new_kw['testLoader'] = TestLoader() + if 'testRunner' not in new_kw: + new_kw['testRunner'] = TestRunner() unittest.main(*args, **new_kw) CheckClean() Index: testShell.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testShell.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** testShell.py 14 Nov 2008 00:22:25 -0000 1.11 --- testShell.py 26 Nov 2008 01:27:40 -0000 1.12 *************** *** 23,28 **** shellLink = pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None, pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink) persistFile = shellLink.QueryInterface(pythoncom.IID_IPersistFile) ! for base_name in os.listdir(desktop): ! name = os.path.join(desktop, base_name) try: persistFile.Load(name,STGM_READ) --- 23,30 ---- shellLink = pythoncom.CoCreateInstance(shell.CLSID_ShellLink, None, pythoncom.CLSCTX_INPROC_SERVER, shell.IID_IShellLink) persistFile = shellLink.QueryInterface(pythoncom.IID_IPersistFile) ! names = [os.path.join(desktop, n) for n in os.listdir(desktop)] ! programs = str(shell.SHGetSpecialFolderPath(0, CSIDL_PROGRAMS)) ! names.extend([os.path.join(programs, n) for n in os.listdir(programs)]) ! for name in names: try: persistFile.Load(name,STGM_READ) *************** *** 36,40 **** if num == 0: # This isn't a fatal error, but is unlikely. ! print "Could not find any links on your desktop, which is unusual" def testShellFolder(self): --- 38,42 ---- if num == 0: # This isn't a fatal error, but is unlikely. ! print "Could not find any links on your desktop or programs dir, which is unusual" def testShellFolder(self): Index: testMSOffice.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testMSOffice.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** testMSOffice.py 18 Nov 2002 11:20:06 -0000 1.7 --- testMSOffice.py 26 Nov 2008 01:27:40 -0000 1.8 *************** *** 135,166 **** def TestAll(): ! try: ! TestWord() ! ! print "Starting Excel for Dynamic test..." ! xl = win32com.client.dynamic.Dispatch("Excel.Application") ! TextExcel(xl) ! try: ! print "Starting Excel 8 for generated excel8.py test..." ! mod = gencache.EnsureModule("{00020813-0000-0000-C000-000000000046}", 0, 1, 2, bForDemand=1) ! xl = win32com.client.Dispatch("Excel.Application") ! TextExcel(xl) ! except ImportError: ! print "Could not import the generated Excel 97 wrapper" ! try: ! import xl5en32 ! mod = gencache.EnsureModule("{00020813-0000-0000-C000-000000000046}", 9, 1, 0) ! xl = win32com.client.Dispatch("Excel.Application.5") ! print "Starting Excel 95 for makepy test..." ! TextExcel(xl) ! except ImportError: ! print "Could not import the generated Excel 95 wrapper" ! except KeyboardInterrupt: ! print "*** Interrupted MSOffice test ***" ! except: ! traceback.print_exc() if __name__=='__main__': --- 135,160 ---- def TestAll(): ! TestWord() ! print "Starting Excel for Dynamic test..." ! xl = win32com.client.dynamic.Dispatch("Excel.Application") ! TextExcel(xl) ! try: ! print "Starting Excel 8 for generated excel8.py test..." ! mod = gencache.EnsureModule("{00020813-0000-0000-C000-000000000046}", 0, 1, 2, bForDemand=1) ! xl = win32com.client.Dispatch("Excel.Application") ! TextExcel(xl) ! except ImportError: ! print "Could not import the generated Excel 97 wrapper" ! try: ! import xl5en32 ! mod = gencache.EnsureModule("{00020813-0000-0000-C000-000000000046}", 9, 1, 0) ! xl = win32com.client.Dispatch("Excel.Application.5") ! print "Starting Excel 95 for makepy test..." ! TextExcel(xl) ! except ImportError: ! print "Could not import the generated Excel 95 wrapper" if __name__=='__main__': Index: testvb.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testvb.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** testvb.py 21 Nov 2006 06:56:04 -0000 1.20 --- testvb.py 26 Nov 2008 01:27:40 -0000 1.21 *************** *** 8,29 **** from win32com.server.util import NewCollection, wrap import string ! import util ! ! importMsg = """\ ! **** VB Test harness is not installed *** ! This test requires a VB test program to be built and installed ! on this PC. ! """ ! ! ### NOTE: VB SUCKS! ! ### If you delete the DLL built by VB, then reopen VB ! ### to rebuild the DLL, it loses the IID of the object!!! ! ### So I will try to avoid this in the future :-) ! ! # Import the type library for the test module. ! try: ! win32com.client.gencache.EnsureDispatch("PyCOMVBTest.Tester") ! except pythoncom.com_error: ! raise RuntimeError, importMsg import traceback --- 8,12 ---- from win32com.server.util import NewCollection, wrap import string ! from win32com.test import util import traceback *************** *** 440,443 **** --- 423,430 ---- def TestAll(): + # Import the type library for the test module. Let the 'invalid clsid' + # exception filter up, where the test runner will treat it as 'skipped' + win32com.client.gencache.EnsureDispatch("PyCOMVBTest.Tester") + if not __debug__: raise RuntimeError, "This must be run in debug mode - we use assert!" *************** *** 446,451 **** --- 433,440 ---- print "All tests appear to have worked!" except: + # ????? print "TestAll() failed!!" traceback.print_exc() + raise # Make this test run under our test suite to leak tests etc work Index: testall.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testall.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** testall.py 11 Nov 2008 01:01:44 -0000 1.28 --- testall.py 26 Nov 2008 01:27:40 -0000 1.29 *************** *** 2,7 **** import pythoncom import win32com.client ! from util import CheckClean, TestCase, CapturingFunctionTestCase, TestLoader ! import win32com.test.util import traceback import getopt --- 2,8 ---- import pythoncom import win32com.client ! from win32com.test.util import (CheckClean, TestCase, ! CapturingFunctionTestCase, ShellTestCase, ! TestLoader, TestRunner, RegisterPythonServer) import traceback import getopt *************** *** 58,61 **** --- 59,68 ---- no_leak_tests = True # done by the test itself def testit(self): + # Check that the item is registered, so we get the correct + # 'skipped' behaviour (and recorded as such) rather than either + # error or silence due to non-registration. + RegisterPythonServer(os.path.join(os.path.dirname(__file__), '..', "servers", "test_pycomtest.py"), + "Python.Test.PyCOMTest") + # Execute testPyComTest in its own process so it can play # with the Python thread state *************** *** 66,69 **** --- 73,80 ---- class PippoTest(TestCase): def testit(self): + # Check we are registered before spawning the process. + from win32com.test import pippo_server + RegisterPythonServer(pippo_server.__file__, "Python.Test.Pippo") + python = sys.executable fname = os.path.join(os.path.dirname(this_file), "testPippo.py") *************** *** 123,128 **** mod_name = test_name func_name = None try: ! mod = __import__(mod_name) except: import_failures.append((mod_name, sys.exc_info()[:2])) --- 134,141 ---- mod_name = test_name func_name = None + fq_mod_name = "win32com.test." + mod_name try: ! __import__(fq_mod_name) ! mod = sys.modules[fq_mod_name] except: import_failures.append((mod_name, sys.exc_info()[:2])) *************** *** 145,150 **** continue if func is not None: ! test = win32com.test.util.CapturingFunctionTestCase(func, ! description=mod_name) else: if hasattr(mod, "suite"): --- 158,162 ---- continue if func is not None: ! test = CapturingFunctionTestCase(func, description=mod_name) else: if hasattr(mod, "suite"): *************** *** 155,159 **** suite.addTest(test) for cmd, output in output_checked_programs[i]: ! suite.addTest(win32com.test.util.ShellTestCase(cmd, output)) for test_class in custom_test_cases[i]: --- 167,171 ---- suite.addTest(test) for cmd, output in output_checked_programs[i]: ! suite.addTest(ShellTestCase(cmd, output)) for test_class in custom_test_cases[i]: *************** *** 202,206 **** # A little row of markers so the dots show how close to finished print '|' * suite.countTestCases() ! testRunner = unittest.TextTestRunner(verbosity=verbosity) testResult = testRunner.run(suite) if import_failures: --- 214,218 ---- # A little row of markers so the dots show how close to finished print '|' * suite.countTestCases() ! testRunner = TestRunner(verbosity=verbosity) testResult = testRunner.run(suite) if import_failures: Index: testExplorer.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testExplorer.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** testExplorer.py 19 Jul 2008 06:23:40 -0000 1.7 --- testExplorer.py 26 Nov 2008 01:27:40 -0000 1.8 *************** *** 9,16 **** import win32gui import win32con import glob import pythoncom import time ! from util import CheckClean bVisibleEventFired = 0 --- 9,17 ---- import win32gui import win32con + import winerror import glob import pythoncom import time ! from win32com.test.util import CheckClean bVisibleEventFired = 0 *************** *** 48,52 **** 'Internet Explorer_Server']: hwnd = win32gui.FindWindowEx(hwnd, 0, child_class, None) ! assert hwnd, "Couldn't find '%s" % (child_class,) # But here is the point - once you have an 'Internet Explorer_Server', # you can send a message and use ObjectFromLresult to get it back. --- 49,53 ---- 'Internet Explorer_Server']: hwnd = win32gui.FindWindowEx(hwnd, 0, child_class, None) ! assert hwnd, "Couldn't find '%s'" % (child_class,) # But here is the point - once you have an 'Internet Explorer_Server', # you can send a message and use ObjectFromLresult to get it back. *************** *** 74,96 **** def TestAll(): try: ! iexplore = win32com.client.dynamic.Dispatch("InternetExplorer.Application") ! TestExplorer(iexplore) ! ! win32api.Sleep(1000) ! iexplore = None ! # Test IE events. ! TestExplorerEvents() ! # Give IE a chance to shutdown, else it can get upset on fast machines. ! time.sleep(2) ! # Note that the TextExplorerEvents will force makepy - hence ! # this gencache is really no longer needed. ! from win32com.client import gencache ! gencache.EnsureModule("{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}", 0, 1, 1) ! iexplore = win32com.client.Dispatch("InternetExplorer.Application") ! TestExplorer(iexplore) finally: iexplore = None --- 75,100 ---- def TestAll(): try: ! try: ! iexplore = win32com.client.dynamic.Dispatch("InternetExplorer.Application") ! TestExplorer(iexplore) ! win32api.Sleep(1000) ! iexplore = None ! # Test IE events. ! TestExplorerEvents() ! # Give IE a chance to shutdown, else it can get upset on fast machines. ! time.sleep(2) ! # Note that the TextExplorerEvents will force makepy - hence ! # this gencache is really no longer needed. + from win32com.client import gencache + gencache.EnsureModule("{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}", 0, 1, 1) + iexplore = win32com.client.Dispatch("InternetExplorer.Application") + TestExplorer(iexplore) + except pythoncom.com_error, exc: + if exc.hresult!=winerror.RPC_E_DISCONNECTED: # user closed the app! + raise finally: iexplore = None Index: testDictionary.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testDictionary.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** testDictionary.py 10 Nov 2003 00:49:29 -0000 1.6 --- testDictionary.py 26 Nov 2008 01:27:40 -0000 1.7 *************** *** 9,13 **** import pywintypes import winerror - L=pywintypes.Unicode import unittest --- 9,12 ---- *************** *** 25,31 **** # Ensure we have the correct version registered. def Register(quiet): ! import win32com.server.register ! from win32com.servers.dictionary import DictionaryPolicy ! win32com.server.register.RegisterClasses(DictionaryPolicy, quiet=quiet) def TestDict(quiet=None): --- 24,30 ---- # Ensure we have the correct version registered. def Register(quiet): ! import win32com.servers.dictionary ! from win32com.test.util import RegisterPythonServer ! RegisterPythonServer(win32com.servers.dictionary.__file__, 'Python.Dictionary') def TestDict(quiet=None): |
From: Mark H. <mha...@us...> - 2008-11-26 01:24:01
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13738 Modified Files: testAXScript.py testArrays.py testPersist.py testPippo.py Log Message: Change to absolute imports to make tests py3k friendly. Index: testAXScript.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testAXScript.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** testAXScript.py 24 Nov 2008 22:21:48 -0000 1.8 --- testAXScript.py 26 Nov 2008 01:23:54 -0000 1.9 *************** *** 32,34 **** if __name__=='__main__': ! unittest.main() --- 32,34 ---- if __name__=='__main__': ! win32com.test.util.testmain() Index: testPippo.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testPippo.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** testPippo.py 24 Nov 2008 22:21:48 -0000 1.5 --- testPippo.py 26 Nov 2008 01:23:54 -0000 1.6 *************** *** 8,12 **** def setUp(self): from win32com.test.util import RegisterPythonServer ! import pippo_server RegisterPythonServer(pippo_server.__file__, "Python.Test.Pippo") # create it. --- 8,12 ---- def setUp(self): from win32com.test.util import RegisterPythonServer ! from win32com.test import pippo_server RegisterPythonServer(pippo_server.__file__, "Python.Test.Pippo") # create it. Index: testArrays.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testArrays.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** testArrays.py 4 May 2004 07:03:04 -0000 1.2 --- testArrays.py 26 Nov 2008 01:23:54 -0000 1.3 *************** *** 2,6 **** # arrays patch. from win32com.client import gencache ! import util import unittest --- 2,6 ---- # arrays patch. from win32com.client import gencache ! from win32com.test import util import unittest Index: testPersist.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testPersist.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** testPersist.py 18 Nov 2002 11:20:07 -0000 1.2 --- testPersist.py 26 Nov 2008 01:23:54 -0000 1.3 *************** *** 1,5 **** import pythoncom import win32com.server.util - import util import time --- 1,4 ---- |
From: Mark H. <mha...@us...> - 2008-11-26 01:21:54
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13682 Modified Files: errorSemantics.py Log Message: Syntax modernizations to make it py3k friendly. Index: errorSemantics.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/errorSemantics.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** errorSemantics.py 7 Sep 2004 02:10:49 -0000 1.6 --- errorSemantics.py 26 Nov 2008 01:21:47 -0000 1.7 *************** *** 32,36 **** def Commit(self, flags): ! raise "foo" def test(): --- 32,36 ---- def Commit(self, flags): ! raise Exception("foo") def test(): *************** *** 39,46 **** try: com_server.Clone() except pythoncom.com_error, com_exc: ! hr, desc, exc, argErr = com_exc ! if hr != winerror.E_UNEXPECTED: raise error("Calling the object natively did not yield the correct scode", com_exc) if not exc or exc[-1] != winerror.E_UNEXPECTED: raise error("The scode element of the exception tuple did not yield the correct scode", com_exc) --- 39,47 ---- try: com_server.Clone() + raise error("Expecting this call to fail!") except pythoncom.com_error, com_exc: ! if com_exc.hresult != winerror.E_UNEXPECTED: raise error("Calling the object natively did not yield the correct scode", com_exc) + exc = com_exc.excepinfo if not exc or exc[-1] != winerror.E_UNEXPECTED: raise error("The scode element of the exception tuple did not yield the correct scode", com_exc) *************** *** 54,62 **** finally: cap.release() except pythoncom.com_error, com_exc: ! hr, desc, exc, argErr = com_exc ! if hr != winerror.E_FAIL: raise error("The hresult was not E_FAIL for an internal error", com_exc) ! if exc[1] != "Python COM Server Internal Error": raise error("The description in the exception tuple did not yield the correct string", com_exc) # Check we saw a traceback in stderr --- 55,63 ---- finally: cap.release() + raise error("Expecting this call to fail!") except pythoncom.com_error, com_exc: ! if com_exc.hresult != winerror.E_FAIL: raise error("The hresult was not E_FAIL for an internal error", com_exc) ! if com_exc.excepinfo[1] != "Python COM Server Internal Error": raise error("The description in the exception tuple did not yield the correct string", com_exc) # Check we saw a traceback in stderr *************** *** 68,75 **** try: com_server.Clone() except pythoncom.com_error, com_exc: ! hr, desc, exc, argErr = com_exc ! if hr != winerror.DISP_E_EXCEPTION: raise error("Calling the object via IDispatch did not yield the correct scode", com_exc) if not exc or exc[-1] != winerror.E_UNEXPECTED: raise error("The scode element of the exception tuple did not yield the correct scode", com_exc) --- 69,77 ---- try: com_server.Clone() + raise error("Expecting this call to fail!") except pythoncom.com_error, com_exc: ! if com_exc.hresult != winerror.DISP_E_EXCEPTION: raise error("Calling the object via IDispatch did not yield the correct scode", com_exc) + exc = com_exc.excepinfo if not exc or exc[-1] != winerror.E_UNEXPECTED: raise error("The scode element of the exception tuple did not yield the correct scode", com_exc) *************** *** 84,91 **** finally: cap.release() except pythoncom.com_error, com_exc: ! hr, desc, exc, argErr = com_exc ! if hr != winerror.DISP_E_EXCEPTION: raise error("Calling the object via IDispatch did not yield the correct scode", com_exc) if not exc or exc[-1] != winerror.E_FAIL: raise error("The scode element of the exception tuple did not yield the correct scode", com_exc) --- 86,94 ---- finally: cap.release() + raise error("Expecting this call to fail!") except pythoncom.com_error, com_exc: ! if com_exc.hresult != winerror.DISP_E_EXCEPTION: raise error("Calling the object via IDispatch did not yield the correct scode", com_exc) + exc = com_exc.excepinfo if not exc or exc[-1] != winerror.E_FAIL: raise error("The scode element of the exception tuple did not yield the correct scode", com_exc) |
From: Mark H. <mha...@us...> - 2008-11-26 01:20:34
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13616 Modified Files: testClipboard.py Log Message: Make test py3k friendly Index: testClipboard.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testClipboard.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** testClipboard.py 4 May 2004 07:02:30 -0000 1.2 --- testClipboard.py 26 Nov 2008 01:20:23 -0000 1.3 *************** *** 46,50 **** if cf == win32con.CF_TEXT: ret_stg = pythoncom.STGMEDIUM() ! ret_stg.set(pythoncom.TYMED_HGLOBAL, self.strval) elif cf == win32con.CF_UNICODETEXT: ret_stg = pythoncom.STGMEDIUM() --- 46,51 ---- if cf == win32con.CF_TEXT: ret_stg = pythoncom.STGMEDIUM() ! # ensure always 'bytes' by encoding string. ! ret_stg.set(pythoncom.TYMED_HGLOBAL, self.strval.encode("ascii")) elif cf == win32con.CF_UNICODETEXT: ret_stg = pythoncom.STGMEDIUM() *************** *** 110,114 **** win32clipboard.OpenClipboard() got = win32clipboard.GetClipboardData(win32con.CF_TEXT) ! self.assertEqual(got, "Hello from Python") # Now check unicode got = win32clipboard.GetClipboardData(win32con.CF_UNICODETEXT) --- 111,117 ---- win32clipboard.OpenClipboard() got = win32clipboard.GetClipboardData(win32con.CF_TEXT) ! # CF_TEXT gives bytes on py3k - use encode() to ensure that's true. ! expected = "Hello from Python".encode("ascii") ! self.assertEqual(got, expected) # Now check unicode got = win32clipboard.GetClipboardData(win32con.CF_UNICODETEXT) *************** *** 118,122 **** def testWin32ToCom(self): # Set the data via the std win32 clipboard functions. ! val = "Hello again!" win32clipboard.OpenClipboard() win32clipboard.SetClipboardData(win32con.CF_TEXT, val) --- 121,125 ---- def testWin32ToCom(self): # Set the data via the std win32 clipboard functions. ! val = "Hello again!".encode("ascii") # ensure always bytes, even in py3k win32clipboard.OpenClipboard() win32clipboard.SetClipboardData(win32con.CF_TEXT, val) *************** *** 130,134 **** # knowing if it meant to be a string, or a binary buffer, so # it must return it too. ! self.failUnlessEqual(got, val+"\0") def testDataObjectFlush(self): --- 133,137 ---- # knowing if it meant to be a string, or a binary buffer, so # it must return it too. ! self.failUnlessEqual(got, "Hello again!\0".encode("ascii")) def testDataObjectFlush(self): *************** *** 152,155 **** if __name__=='__main__': ! import util util.testmain() --- 155,158 ---- if __name__=='__main__': ! from win32com.test import util util.testmain() |
From: Mark H. <mha...@us...> - 2008-11-26 01:19:37
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/extensions In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13555/extensions Modified Files: PySTGMEDIUM.cpp Log Message: Special handling for unicode so Py3k can pass unicode objects as a HGLOBAL in a STGMEDIUM. Index: PySTGMEDIUM.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/extensions/PySTGMEDIUM.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PySTGMEDIUM.cpp 3 Jun 2007 09:40:56 -0000 1.8 --- PySTGMEDIUM.cpp 26 Nov 2008 01:19:25 -0000 1.9 *************** *** 55,69 **** const void * buf = NULL; Py_ssize_t cb = 0; ! if (PyObject_AsReadBuffer(ob,&buf,&cb)==-1) ! return PyErr_Format(PyExc_TypeError, "tymed value of %d requires a string/unicode/buffer", tymed); ! // size doesnt include nulls! // We need to include the NULL for strings and unicode, as the // Windows clipboard functions will assume it is there for // text related formats (eg, CF_TEXT). ! if (PyString_Check(ob)) ! cb += 1; ! else if (PyUnicode_Check(ob)) ! cb += sizeof(wchar_t); ! // else assume buffer needs no terminator... ps->medium.hGlobal = GlobalAlloc(GMEM_FIXED, cb); if (!ps->medium.hGlobal) --- 55,74 ---- const void * buf = NULL; Py_ssize_t cb = 0; ! // In py3k, unicode objects don't support the buffer ! // protocol, so explicitly check string types first. // We need to include the NULL for strings and unicode, as the // Windows clipboard functions will assume it is there for // text related formats (eg, CF_TEXT). ! if (PyString_Check(ob)) { ! cb = PyString_GET_SIZE(ob) + 1; // for the NULL ! buf = (void *)PyString_AS_STRING(ob); ! } else if (PyUnicode_Check(ob)) { ! cb = PyUnicode_GET_DATA_SIZE(ob) + sizeof(Py_UNICODE); ! buf = (void *)PyUnicode_AS_UNICODE(ob); ! } else { ! if (PyObject_AsReadBuffer(ob,&buf,&cb)==-1) ! return PyErr_Format(PyExc_TypeError, "tymed value of %d requires a string/unicode/buffer", tymed); ! // no extra nulls etc needed here. ! } ps->medium.hGlobal = GlobalAlloc(GMEM_FIXED, cb); if (!ps->medium.hGlobal) |
From: Mark H. <mha...@us...> - 2008-11-26 01:18:48
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13515 Modified Files: ErrorUtils.cpp dllmain.cpp Log Message: Merge various py3k friendly improvements and consolidations from py3k branch. Index: ErrorUtils.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/ErrorUtils.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** ErrorUtils.cpp 13 Nov 2008 11:11:58 -0000 1.31 --- ErrorUtils.cpp 26 Nov 2008 01:18:31 -0000 1.32 *************** *** 53,73 **** PyErr_Clear(); // Not a special exception object - do the best we can. - PyObject *obException = PyObject_Str(exception); - PyObject *obValue = PyObject_Str(v); - char *szException = PyString_AsString(obException); - char *szValue = PyString_AsString(obValue); char *szBaseMessage = "Unexpected Python Error: "; ! if (szException==NULL) szException = "<bad exception>"; ! if (szValue==NULL) szValue = "<bad exception value>"; ! int len = strlen(szBaseMessage) + strlen(szException) + 2 + strlen(szValue) + 1; ! // 2 for ": " ! // message could be quite long - be safe. char *tempBuf = new char[len]; if (tempBuf) { ! strcpy(tempBuf, szBaseMessage); ! strcat(tempBuf, szException); ! strcat(tempBuf, ": "); ! strcat(tempBuf, szValue); pExcepInfo->bstrDescription = PyWin_String_AsBstr(tempBuf); } else pExcepInfo->bstrDescription = SysAllocString(L"memory error allocating exception buffer!"); --- 53,64 ---- PyErr_Clear(); // Not a special exception object - do the best we can. char *szBaseMessage = "Unexpected Python Error: "; ! char *szException = GetPythonTraceback(exception, v, tb); ! size_t len = strlen(szBaseMessage) + strlen(szException) + 1; char *tempBuf = new char[len]; if (tempBuf) { ! snprintf(tempBuf, len, "%s%s", szBaseMessage, szException); pExcepInfo->bstrDescription = PyWin_String_AsBstr(tempBuf); + delete [] tempBuf; } else pExcepInfo->bstrDescription = SysAllocString(L"memory error allocating exception buffer!"); *************** *** 82,93 **** // Any other common Python exceptions we should map? pExcepInfo->scode = E_FAIL; - - delete [] tempBuf; - Py_XDECREF(obException); - Py_XDECREF(obValue); } - Py_XDECREF(tb); Py_XDECREF(exception); Py_XDECREF(v); PyErr_Clear(); } --- 73,80 ---- // Any other common Python exceptions we should map? pExcepInfo->scode = E_FAIL; } Py_XDECREF(exception); Py_XDECREF(v); + Py_XDECREF(tb); PyErr_Clear(); } *************** *** 197,204 **** // Note that with class based exceptions, a simple pointer check fails. // Any class sub-classed from the client is considered a server error, ! // so we need to check the class explicitely. ! if (v==PyWinExc_COMError || // String exceptions ! (PyInstance_Check(v) && // Class exceptions ! (PyObject *)(((PyInstanceObject *)v)->in_class)==PyWinExc_COMError) ) { // Client side error // Clear the state of the excep info. --- 184,189 ---- // Note that with class based exceptions, a simple pointer check fails. // Any class sub-classed from the client is considered a server error, ! // so we need to check the class explicitly. ! if ((PyObject *)v->ob_type==PyWinExc_COMError) { // Client side error // Clear the state of the excep info. *************** *** 369,465 **** } - //////////////////////////////////////////////////////////////////////// - // Some logging functions - //////////////////////////////////////////////////////////////////////// - /* Obtains a string from a Python traceback. - This is the exact same string as "traceback.print_exc" would return. - - Pass in a Python traceback object (probably obtained from PyErr_Fetch()) - Result is a string which must be free'd using PyMem_Free() - */ - #define TRACEBACK_FETCH_ERROR(what) {errMsg = what; goto done;} - - char *PyTraceback_AsString(PyObject *exc_tb) - { - char *errMsg = NULL; /* holds a local error message */ - char *result = NULL; /* a valid, allocated result. */ - PyObject *modStringIO = NULL; - PyObject *modTB = NULL; - PyObject *obFuncStringIO = NULL; - PyObject *obStringIO = NULL; - PyObject *obFuncTB = NULL; - PyObject *argsTB = NULL; - PyObject *obResult = NULL; - - /* Import the modules we need - cStringIO and traceback */ - modStringIO = PyImport_ImportModule("cStringIO"); - if (modStringIO==NULL) - TRACEBACK_FETCH_ERROR("cant import cStringIO\n"); - - modTB = PyImport_ImportModule("traceback"); - if (modTB==NULL) - TRACEBACK_FETCH_ERROR("cant import traceback\n"); - /* Construct a cStringIO object */ - obFuncStringIO = PyObject_GetAttrString(modStringIO, "StringIO"); - if (obFuncStringIO==NULL) - TRACEBACK_FETCH_ERROR("cant find cStringIO.StringIO\n"); - obStringIO = PyObject_CallObject(obFuncStringIO, NULL); - if (obStringIO==NULL) - TRACEBACK_FETCH_ERROR("cStringIO.StringIO() failed\n"); - /* Get the traceback.print_exception function, and call it. */ - obFuncTB = PyObject_GetAttrString(modTB, "print_tb"); - if (obFuncTB==NULL) - TRACEBACK_FETCH_ERROR("cant find traceback.print_tb\n"); - - argsTB = Py_BuildValue("OOO", - exc_tb ? exc_tb : Py_None, - Py_None, - obStringIO); - if (argsTB==NULL) - TRACEBACK_FETCH_ERROR("cant make print_tb arguments\n"); - - obResult = PyObject_CallObject(obFuncTB, argsTB); - if (obResult==NULL) - TRACEBACK_FETCH_ERROR("traceback.print_tb() failed\n"); - /* Now call the getvalue() method in the StringIO instance */ - Py_DECREF(obFuncStringIO); - obFuncStringIO = PyObject_GetAttrString(obStringIO, "getvalue"); - if (obFuncStringIO==NULL) - TRACEBACK_FETCH_ERROR("cant find getvalue function\n"); - Py_DECREF(obResult); - obResult = PyObject_CallObject(obFuncStringIO, NULL); - if (obResult==NULL) - TRACEBACK_FETCH_ERROR("getvalue() failed.\n"); - - /* And it should be a string all ready to go - duplicate it. */ - if (!PyString_Check(obResult)) - TRACEBACK_FETCH_ERROR("getvalue() did not return a string\n"); - - { // a temp scope so I can use temp locals. - char *tempResult = PyString_AsString(obResult); - result = (char *)PyMem_Malloc(strlen(tempResult)+1); - if (result==NULL) - TRACEBACK_FETCH_ERROR("memory error duplicating the traceback string\n"); - - strcpy(result, tempResult); - } // end of temp scope. - done: - /* All finished - first see if we encountered an error */ - if (result==NULL && errMsg != NULL) { - result = (char *)PyMem_Malloc(strlen(errMsg)+1); - if (result != NULL) - /* if it does, not much we can do! */ - strcpy(result, errMsg); - } - Py_XDECREF(modStringIO); - Py_XDECREF(modTB); - Py_XDECREF(obFuncStringIO); - Py_XDECREF(obStringIO); - Py_XDECREF(obFuncTB); - Py_XDECREF(argsTB); - Py_XDECREF(obResult); - return result; - } - void PyCom_StreamMessage(const char *pszMessageText) { --- 354,357 ---- *************** *** 545,574 **** void _LogException(PyObject *exc_typ, PyObject *exc_val, PyObject *exc_tb) { ! if (exc_tb) { ! const char *szTraceback = PyTraceback_AsString(exc_tb); ! if (szTraceback == NULL) ! PyCom_StreamMessage("Can't get the traceback info!"); ! else { ! PyCom_StreamMessage(traceback_prefix); ! PyCom_StreamMessage(szTraceback); ! PyMem_Free((void *)szTraceback); ! } ! } ! PyObject *temp = PyObject_Str(exc_typ); ! if (temp) { ! PyCom_StreamMessage(PyString_AsString(temp)); ! Py_DECREF(temp); ! } else ! PyCom_StreamMessage("Can't convert exception to a string!"); ! PyCom_StreamMessage(": "); ! if (exc_val != NULL) { ! temp = PyObject_Str(exc_val); ! if (temp) { ! PyCom_StreamMessage(PyString_AsString(temp)); ! Py_DECREF(temp); ! } else ! PyCom_StreamMessage("Can't convert exception value to a string!"); ! } ! PyCom_StreamMessage("\n"); } --- 437,443 ---- void _LogException(PyObject *exc_typ, PyObject *exc_val, PyObject *exc_tb) { ! char *szTraceback = GetPythonTraceback(exc_typ, exc_val, exc_tb); ! PyCom_StreamMessage(szTraceback); ! free(szTraceback); } *************** *** 625,637 **** } ! BOOL IsNonServerErrorCurrent() { BOOL rc = FALSE; PyObject *exc_typ = NULL, *exc_val = NULL, *exc_tb = NULL; PyErr_Fetch( &exc_typ, &exc_val, &exc_tb); if (exc_typ) { PyErr_NormalizeException( &exc_typ, &exc_val, &exc_tb); ! rc = (!PyErr_GivenExceptionMatches(exc_val, PyWinExc_COMError) || ! ((PyInstance_Check(exc_val) && ! (PyObject *)(((PyInstanceObject *)exc_val)->in_class)==PyWinExc_COMError))); } PyErr_Restore(exc_typ, exc_val, exc_tb); --- 494,511 ---- } ! // Is the current exception a "server" exception? - ie, one explicitly ! // thrown by Python code to indicate an error. This is defined as ! // any exception whose type is a subclass of com_error (a plain ! // com_error probably means an unhandled exception from someone ! // calling an interface) ! BOOL IsServerErrorCurrent() { BOOL rc = FALSE; PyObject *exc_typ = NULL, *exc_val = NULL, *exc_tb = NULL; PyErr_Fetch( &exc_typ, &exc_val, &exc_tb); + assert(exc_typ); // we should only be called with an exception current. if (exc_typ) { PyErr_NormalizeException( &exc_typ, &exc_val, &exc_tb); ! // so it must "match" a com_error, but not be *exactly* a COM error. ! rc = PyErr_GivenExceptionMatches(exc_val, PyWinExc_COMError) && exc_typ != PyWinExc_COMError; } PyErr_Restore(exc_typ, exc_val, exc_tb); *************** *** 656,660 **** void PyCom_LoggerNonServerException(PyObject *logProvider, const char *fmt, ...) { ! if (!IsNonServerErrorCurrent()) return; va_list marker; --- 530,534 ---- void PyCom_LoggerNonServerException(PyObject *logProvider, const char *fmt, ...) { ! if (IsServerErrorCurrent()) return; va_list marker; *************** *** 855,859 **** --- 729,735 ---- // //////////////////////////////////////////////////////////////////////// + #ifndef _countof #define _countof(array) (sizeof(array)/sizeof(array[0])) + #endif void GetScodeString(HRESULT hr, LPTSTR buf, int bufSize) Index: dllmain.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/src/dllmain.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** dllmain.cpp 13 Nov 2008 11:11:58 -0000 1.16 --- dllmain.cpp 26 Nov 2008 01:18:31 -0000 1.17 *************** *** 312,317 **** { // A scope for _celp CEnterLeavePython _celp; ! PySys_SetArgv(argc, argv); if (PyRun_SimpleFile(fp, (char *)fileName) != 0) { --- 312,320 ---- { // A scope for _celp CEnterLeavePython _celp; ! #if (PY_VERSION_HEX < 0x03000000) PySys_SetArgv(argc, argv); + #else + PySys_SetArgv(argc, __wargv); + #endif; if (PyRun_SimpleFile(fp, (char *)fileName) != 0) { |
From: Mark H. <mha...@us...> - 2008-11-26 01:16:31
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13456 Modified Files: policySemantics.py Log Message: replace reduce/lambda with sum() to make it py3k friendly. Index: policySemantics.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/policySemantics.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** policySemantics.py 10 Nov 2003 00:49:29 -0000 1.4 --- policySemantics.py 26 Nov 2008 01:16:13 -0000 1.5 *************** *** 23,27 **** def _Evaluate(self): # return the sum ! return reduce(lambda a,b: a+b, self.list, 0) def In(self, value): return value in self.list --- 23,27 ---- def _Evaluate(self): # return the sum ! return sum(self.list) def In(self, value): return value in self.list |
From: Mark H. <mha...@us...> - 2008-11-26 01:14:48
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/axscript/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13317/axscript/test Modified Files: testHost.py Log Message: Syntax modernizations for use with py3k Index: testHost.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/axscript/test/testHost.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** testHost.py 7 May 2007 02:27:44 -0000 1.5 --- testHost.py 26 Nov 2008 01:14:40 -0000 1.6 *************** *** 1,7 **** ! import string, sys from win32com.axscript.server.error import Exception from win32com.axscript import axscript from win32com.axscript.server import axsite - import pythoncom from win32com.server import util, connect import win32com.server.policy --- 1,7 ---- ! import sys ! import pythoncom from win32com.axscript.server.error import Exception from win32com.axscript import axscript from win32com.axscript.server import axsite from win32com.server import util, connect import win32com.server.policy *************** *** 31,35 **** if st is None: st = "" text = st + "\n" + (" " * (char-1)) + "^" + "\n" + exc[2] ! for line in string.split(text,"\n"): print " >" + line --- 31,35 ---- if st is None: st = "" text = st + "\n" + (" " * (char-1)) + "^" + "\n" + exc[2] ! for line in text.splitlines(): print " >" + line *************** *** 49,53 **** def echo(self, *args): ! self.last = string.join(map(str, args)) if self.verbose: for arg in args: --- 49,53 ---- def echo(self, *args): ! self.last = "".join([str(s) for s in args]) if self.verbose: for arg in args: *************** *** 125,131 **** """ PyScript_Exc = u"""\ def hello(arg1): ! raise RuntimeError, "exc with extended \xa9har" """ --- 125,134 ---- """ + # XXX - needs py3k work! Throwing a bytes string with an extended char + # doesn't make much sense, but py2x allows it. What it gets upset with + # is a real unicode arg - which is the only thing py3k allows! PyScript_Exc = u"""\ def hello(arg1): ! raise RuntimeError("exc with extended \xa9har") """ |