[pywin32-checkins] /hgrepo/p/py/pywin32/pywin32: 5 new changesets
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <pyw...@li...> - 2012-01-02 06:55:29
|
changeset dc4e26c4e6a4 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=dc4e26c4e6a4 summary: Auto complete examines all implemented IDispatch types - Oliver Tengler via #3433953. changeset 0dc6321ba653 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=0dc6321ba653 summary: add service modules to the start of sys.patch instead of the end (rvolpe via #3194663) changeset 46dd04e78b63 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=46dd04e78b63 summary: refactor many #include statements to avoid py3k breakage changeset 6f4fc5dc4420 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=6f4fc5dc4420 summary: add some VT_R4 and VT_R8 safearray tests changeset cc10aa149c2c in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=cc10aa149c2c summary: fix testPersist on py3k diffstat: CHANGES.txt | 7 + Pythonwin/pywin/scintilla/view.py | 32 +++- Pythonwin/stdafx.h | 2 + Pythonwin/stdafxdde.h | 3 + Pythonwin/stdafxole.h | 2 + SWIG/swig_lib/python/pywintypes.i | 2 - com/TestSources/PyCOMTest/PyCOMImpl.cpp | 113 ++++++++------- com/TestSources/PyCOMTest/PyCOMImpl.h | 3 + com/TestSources/PyCOMTest/PyCOMTest.idl | 3 + com/win32com/test/testPersist.py | 14 +- com/win32com/test/testPyComTest.py | 24 +++ com/win32comext/axcontrol/src/axcontrol_pch.h | 6 +- com/win32comext/bits/src/PyIBackgroundCopyFile.h | 3 - com/win32comext/bits/src/PyIBackgroundCopyFile2.h | 3 - com/win32comext/bits/src/PyIBackgroundCopyJob.h | 3 - com/win32comext/bits/src/PyIBackgroundCopyJob2.h | 1 - com/win32comext/bits/src/PyIBackgroundCopyManager.h | 3 - com/win32comext/bits/src/PyIEnumBackgroundCopyFiles.cpp | 1 + com/win32comext/bits/src/PyIEnumBackgroundCopyFiles.h | 3 - com/win32comext/bits/src/PyIEnumBackgroundCopyJobs.cpp | 1 + com/win32comext/bits/src/PyIEnumBackgroundCopyJobs.h | 3 - com/win32comext/bits/src/bits.cpp | 2 +- com/win32comext/bits/src/bits_pch.h | 3 +- com/win32comext/directsound/src/directsound_pch.h | 2 - com/win32comext/ifilter/src/stdafx.h | 7 +- com/win32comext/internet/src/internet_pch.h | 6 +- com/win32comext/mapi/src/mapiutil.cpp | 2 - com/win32comext/propsys/src/propsys.cpp | 2 +- com/win32comext/shell/src/shell_pch.h | 6 +- com/win32comext/taskscheduler/src/PyIProvideTaskPage.h | 2 +- com/win32comext/taskscheduler/src/PyITaskScheduler.h | 2 +- com/win32comext/taskscheduler/src/PyITaskTrigger.h | 2 +- isapi/src/StdAfx.h | 2 + win32/src/PerfMon/MappingManager.cpp | 3 - win32/src/PerfMon/PerfCounterDefn.cpp | 3 - win32/src/PerfMon/PyPerfMon.cpp | 4 - win32/src/PyWinTypes.h | 5 + win32/src/PythonService.cpp | 8 +- win32/src/_win32sysloader.cpp | 5 + win32/src/timermodule.cpp | 2 - win32/src/win32inet_winhttp.cpp | 3 +- win32/src/win32pdhmodule.cpp | 6 +- win32/src/win32popen.cpp | 2 - win32/src/win32rasmodule.cpp | 5 +- win32/src/win32wnet/PyNetresource.cpp | 2 - win32/src/win32wnet/win32wnet.cpp | 2 - 46 files changed, 175 insertions(+), 145 deletions(-) diffs (truncated from 853 to 300 lines): diff -r 9b3d4f355d25 -r cc10aa149c2c CHANGES.txt --- a/CHANGES.txt Mon Jan 02 13:03:39 2012 +1100 +++ b/CHANGES.txt Mon Jan 02 17:53:18 2012 +1100 @@ -6,6 +6,13 @@ Since build 216: ---------------- +* Python service module will now have their directory added to the start + of sys.path rather than the end to avoid cryptic error messages if a + module of the same name is already on the path (rvolpe via #3194663) + +* Various Pythonwin autocomplete enhancements (kxroberto via #3468282 and + Oliver Tengler via #3433953) + * The Pythonwin editor now remembers previous searches made in this session. (patch #3468280 from kxroberto). diff -r 9b3d4f355d25 -r cc10aa149c2c Pythonwin/pywin/scintilla/view.py --- a/Pythonwin/pywin/scintilla/view.py Mon Jan 02 13:03:39 2012 +1100 +++ b/Pythonwin/pywin/scintilla/view.py Mon Jan 02 17:53:18 2012 +1100 @@ -436,12 +436,7 @@ try: for iTI in xrange(0,ob._oleobj_.GetTypeInfoCount()): typeInfo = ob._oleobj_.GetTypeInfo(iTI) - typeAttr = typeInfo.GetTypeAttr() - for iFun in xrange(0,typeAttr.cFuncs): - funDesc = typeInfo.GetFuncDesc(iFun) - funName = typeInfo.GetNames(funDesc.memid)[0] - if funName not in items_dict: - items_dict[funName] = None + self._UpdateWithITypeInfo (items_dict, typeInfo) except: pass except: @@ -491,6 +486,31 @@ self.SCIAutoCSetAutoHide(0) self.SCIAutoCShow(items) + def _UpdateWithITypeInfo (self, items_dict, typeInfo): + import pythoncom + typeInfos = [typeInfo] + # suppress IDispatch and IUnknown methods + inspectedIIDs = {pythoncom.IID_IDispatch:None} + + while len(typeInfos)>0: + typeInfo = typeInfos.pop() + typeAttr = typeInfo.GetTypeAttr() + + if typeAttr.iid not in inspectedIIDs: + inspectedIIDs[typeAttr.iid] = None + for iFun in xrange(0,typeAttr.cFuncs): + funDesc = typeInfo.GetFuncDesc(iFun) + funName = typeInfo.GetNames(funDesc.memid)[0] + if funName not in items_dict: + items_dict[funName] = None + + # Inspect the type info of all implemented types + # E.g. IShellDispatch5 implements IShellDispatch4 which implements IShellDispatch3 ... + for iImplType in xrange(0,typeAttr.cImplTypes): + iRefType = typeInfo.GetRefTypeOfImplType(iImplType) + refTypeInfo = typeInfo.GetRefTypeInfo(iRefType) + typeInfos.append(refTypeInfo) + # TODO: This is kinda slow. Probably need some kind of cache # here that is flushed upon file save # Or maybe we don't need the superclass methods at all ? diff -r 9b3d4f355d25 -r cc10aa149c2c Pythonwin/stdafx.h --- a/Pythonwin/stdafx.h Mon Jan 02 13:03:39 2012 +1100 +++ b/Pythonwin/stdafx.h Mon Jan 02 17:53:18 2012 +1100 @@ -34,6 +34,8 @@ programmers who forget to use the new names. */ #undef INCREF #undef DECREF +// windows defines "small" as "char" which breaks Python's accu.h +#undef small #include "Python.h" #include "modsupport.h" #include "traceback.h" diff -r 9b3d4f355d25 -r cc10aa149c2c Pythonwin/stdafxdde.h --- a/Pythonwin/stdafxdde.h Mon Jan 02 13:03:39 2012 +1100 +++ b/Pythonwin/stdafxdde.h Mon Jan 02 17:53:18 2012 +1100 @@ -4,6 +4,9 @@ #include <limits.h> #include <basetyps.h> + +// windows defines "small" as "char" which breaks Python's accu.h +#undef small #include <Python.h> // The Pythonwin stuff diff -r 9b3d4f355d25 -r cc10aa149c2c Pythonwin/stdafxole.h --- a/Pythonwin/stdafxole.h Mon Jan 02 13:03:39 2012 +1100 +++ b/Pythonwin/stdafxole.h Mon Jan 02 17:53:18 2012 +1100 @@ -20,6 +20,8 @@ // allow memory leaks to give me the line number. //#define new DEBUG_NEW +// windows defines "small" as "char" which breaks Python's accu.h +#undef small #include "Python.h" #include "modsupport.h" #include "traceback.h" diff -r 9b3d4f355d25 -r cc10aa149c2c SWIG/swig_lib/python/pywintypes.i --- a/SWIG/swig_lib/python/pywintypes.i Mon Jan 02 13:03:39 2012 +1100 +++ b/SWIG/swig_lib/python/pywintypes.i Mon Jan 02 17:53:18 2012 +1100 @@ -35,8 +35,6 @@ %{ -#include "windows.h" -#include "winbase.h" #include "PyWinTypes.h" #ifdef NEED_PYWINOBJECTS_H #include "PyWinObjects.h" diff -r 9b3d4f355d25 -r cc10aa149c2c com/TestSources/PyCOMTest/PyCOMImpl.cpp --- a/com/TestSources/PyCOMTest/PyCOMImpl.cpp Mon Jan 02 13:03:39 2012 +1100 +++ b/com/TestSources/PyCOMTest/PyCOMImpl.cpp Mon Jan 02 17:53:18 2012 +1100 @@ -275,77 +275,82 @@ return S_OK; } -STDMETHODIMP CPyCOMTest::SetBinSafeArray(SAFEARRAY* buf, int *resultSize) +HRESULT _SetArrayHelper(VARTYPE expectedType, SAFEARRAY *vals, int *resultSize) { - UINT cDims = SafeArrayGetDim(buf); + VARTYPE gotType; + HRESULT hr = SafeArrayGetVartype(vals, &gotType); + if (FAILED(hr)) { + return hr; + } + if (gotType != expectedType) { + return E_UNEXPECTED; + } + UINT cDims = SafeArrayGetDim(vals); *resultSize = 0; long ub=0, lb=0; if (cDims) { - SafeArrayGetUBound(buf, 1, &ub); - SafeArrayGetLBound(buf, 1, &lb); - *resultSize = ub - lb + 1; - } - TCHAR dbgbuf[256]; - wsprintf(dbgbuf, _T("Have binary SafeArray with %d dims and size %d\n"), cDims, *resultSize); - OutputDebugString(dbgbuf); - return S_OK; -} - -STDMETHODIMP CPyCOMTest::SetIntSafeArray(SAFEARRAY* ints, int *resultSize) -{ - TCHAR buf[256]; - UINT cDims = SafeArrayGetDim(ints); - *resultSize = 0; - long ub=0, lb=0; - if (cDims) { - SafeArrayGetUBound(ints, 1, &ub); - SafeArrayGetLBound(ints, 1, &lb); - *resultSize = ub - lb + 1; - } - wsprintf(buf, _T("Have VARIANT SafeArray with %d dims and size %d\n"), cDims, *resultSize); - OutputDebugString(buf); - return S_OK; -} - -STDMETHODIMP CPyCOMTest::SetLongLongSafeArray(SAFEARRAY* ints, int *resultSize) -{ - UINT cDims = SafeArrayGetDim(ints); - *resultSize = 0; - long ub=0, lb=0; - if (cDims) { - SafeArrayGetUBound(ints, 1, &ub); - SafeArrayGetLBound(ints, 1, &lb); + SafeArrayGetUBound(vals, 1, &ub); + SafeArrayGetLBound(vals, 1, &lb); *resultSize = ub - lb + 1; } return S_OK; } +STDMETHODIMP CPyCOMTest::SetBinSafeArray(SAFEARRAY* buf, int *resultSize) +{ + return _SetArrayHelper(VT_UI1, buf, resultSize); +} + +STDMETHODIMP CPyCOMTest::SetIntSafeArray(SAFEARRAY* ints, int *resultSize) +{ + return _SetArrayHelper(VT_I4, ints, resultSize); +} + +STDMETHODIMP CPyCOMTest::SetLongLongSafeArray(SAFEARRAY* ints, int *resultSize) +{ + return _SetArrayHelper(VT_I8, ints, resultSize); +} + STDMETHODIMP CPyCOMTest::SetULongLongSafeArray(SAFEARRAY* ints, int *resultSize) { - UINT cDims = SafeArrayGetDim(ints); - *resultSize = 0; - long ub=0, lb=0; - if (cDims) { - SafeArrayGetUBound(ints, 1, &ub); - SafeArrayGetLBound(ints, 1, &lb); - *resultSize = ub - lb + 1; - } - return S_OK; + return _SetArrayHelper(VT_UI8, ints, resultSize); } STDMETHODIMP CPyCOMTest::SetVariantSafeArray(SAFEARRAY* vars, int *resultSize) { - TCHAR buf[256]; - UINT cDims = SafeArrayGetDim(vars); - *resultSize = 0; + return _SetArrayHelper(VT_VARIANT, vars, resultSize); +} + +STDMETHODIMP CPyCOMTest::SetDoubleSafeArray(SAFEARRAY* vals, int *resultSize) +{ + return _SetArrayHelper(VT_R8, vals, resultSize); +} + +STDMETHODIMP CPyCOMTest::SetFloatSafeArray(SAFEARRAY* vals, int *resultSize) +{ + return _SetArrayHelper(VT_R4, vals, resultSize); +} + +STDMETHODIMP CPyCOMTest::ChangeDoubleSafeArray(SAFEARRAY** vals) +{ + UINT cDims = SafeArrayGetDim(*vals); + if (cDims != 1) { + return E_UNEXPECTED; + } + HRESULT hr; long ub=0, lb=0; - if (cDims) { - SafeArrayGetUBound(vars, 1, &ub); - SafeArrayGetLBound(vars, 1, &lb); - *resultSize = ub - lb + 1; + SafeArrayGetUBound(*vals, 1, &ub); + SafeArrayGetLBound(*vals, 1, &lb); + for (long i=lb; i <= ub; i++) { + double val; + hr = SafeArrayGetElement(*vals, &i, &val); + if (FAILED(hr)) + return hr; + val *= 2; + hr = SafeArrayPutElement(*vals, &i, &val); + if (FAILED(hr)) + return hr; } - wsprintf(buf, _T("Have VARIANT SafeArray with %d dims and size %d\n"), cDims, *resultSize); - OutputDebugString(buf); return S_OK; } diff -r 9b3d4f355d25 -r cc10aa149c2c com/TestSources/PyCOMTest/PyCOMImpl.h --- a/com/TestSources/PyCOMTest/PyCOMImpl.h Mon Jan 02 13:03:39 2012 +1100 +++ b/com/TestSources/PyCOMTest/PyCOMImpl.h Mon Jan 02 17:53:18 2012 +1100 @@ -80,10 +80,13 @@ STDMETHOD(SetLongLongSafeArray)(SAFEARRAY* ints, int *retSize); STDMETHOD(SetULongLongSafeArray)(SAFEARRAY* ints, int *retSize); STDMETHOD(SetVariantSafeArray)(SAFEARRAY* vars, int *retSize); + STDMETHOD(SetDoubleSafeArray)(SAFEARRAY* vars, int *retSize); + STDMETHOD(SetFloatSafeArray)(SAFEARRAY* vars, int *retSize); STDMETHOD(GetSafeArrays)(SAFEARRAY** attrs, SAFEARRAY**attrs2, SAFEARRAY** ints); STDMETHOD(GetSimpleSafeArray)(SAFEARRAY** ints); + STDMETHOD(ChangeDoubleSafeArray)(SAFEARRAY **vals); STDMETHOD(GetSimpleCounter)(ISimpleCounter** counter); STDMETHOD(CheckVariantSafeArray)(SAFEARRAY **vals, int *result); diff -r 9b3d4f355d25 -r cc10aa149c2c com/TestSources/PyCOMTest/PyCOMTest.idl --- a/com/TestSources/PyCOMTest/PyCOMTest.idl Mon Jan 02 13:03:39 2012 +1100 +++ b/com/TestSources/PyCOMTest/PyCOMTest.idl Mon Jan 02 17:53:18 2012 +1100 @@ -217,10 +217,13 @@ HRESULT SetLongLongSafeArray([in] SAFEARRAY(long long) ints, [out, retval]int *resultSize); HRESULT SetULongLongSafeArray([in] SAFEARRAY(unsigned long long) ints, [out, retval]int *resultSize); HRESULT SetVariantSafeArray([in] SAFEARRAY(VARIANT) vars, [out, retval]int *resultSize); + HRESULT SetDoubleSafeArray([in] SAFEARRAY(double) vals, [out, retval]int *resultSize); + HRESULT SetFloatSafeArray([in] SAFEARRAY(float) vals, [out, retval]int *resultSize); HRESULT GetSimpleSafeArray([out] SAFEARRAY(int)* ints); HRESULT GetSafeArrays([out] SAFEARRAY(QsAttribute)* attrs, [out] SAFEARRAY(enum tagQsAttribute)*attrs2, [out] SAFEARRAY(int)*ints); + HRESULT ChangeDoubleSafeArray([in, out]SAFEARRAY(double)*vals); HRESULT GetSimpleCounter([out, retval] ISimpleCounter** counter); HRESULT CheckVariantSafeArray([in] SAFEARRAY(VARIANT)* data, [out, retval]int *sum); diff -r 9b3d4f355d25 -r cc10aa149c2c com/win32com/test/testPersist.py --- a/com/win32com/test/testPersist.py Mon Jan 02 13:03:39 2012 +1100 +++ b/com/win32com/test/testPersist.py Mon Jan 02 17:53:18 2012 +1100 @@ -15,15 +15,23 @@ import win32ui import win32api, os +from pywin32_testutil import str2bytes + S_OK = 0 |