pywin32-checkins Mailing List for Python for Windows Extensions (Page 6)
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: <pyw...@li...> - 2012-07-16 06:57:18
|
changeset c8d9bd8b3ca9 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=c8d9bd8b3ca9 summary: use iter().next() instead of next(iter()) for compat with 2.5- diffstat: com/win32com/__init__.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 48976afd6865 -r c8d9bd8b3ca9 com/win32com/__init__.py --- a/com/win32com/__init__.py Sun Jul 15 14:59:11 2012 -0400 +++ b/com/win32com/__init__.py Mon Jul 16 16:56:43 2012 +1000 @@ -90,7 +90,7 @@ # hrmph - 3.3 throws: TypeError: '_NamespacePath' object does not support indexing # attempting to get __path__[0] - but I can't quickly repro this stand-alone. # Work around it by using an iterator. - __gen_path__ = next(iter(sys.modules["win32com.gen_py"].__path__)) + __gen_path__ = iter(sys.modules["win32com.gen_py"].__path__).next() except ImportError: # If a win32com\gen_py directory already exists, then we use it # (gencache doesn't insist it have an __init__, but our __import__ |
|
From: <pyw...@li...> - 2012-07-15 19:01:13
|
changeset 48976afd6865 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=48976afd6865 summary: Enable GetPropertyStoreForKeys and fix a default value diffstat: com/win32comext/shell/src/PyIShellItem2.cpp | 43 ++++++++++++++++++++-------- 1 files changed, 30 insertions(+), 13 deletions(-) diffs (99 lines): diff -r 60947f18882f -r 48976afd6865 com/win32comext/shell/src/PyIShellItem2.cpp --- a/com/win32comext/shell/src/PyIShellItem2.cpp Sun Jul 15 10:45:20 2012 -0400 +++ b/com/win32comext/shell/src/PyIShellItem2.cpp Sun Jul 15 14:59:11 2012 -0400 @@ -33,7 +33,7 @@ return NULL; void *ret; - GETPROPERTYSTOREFLAGS flags; + GETPROPERTYSTOREFLAGS flags = GPS_DEFAULT; IID riid = IID_IPropertyStore; // @pyparm int|Flags|GPS_DEFAULT|Combination of GETPROPERTYSTOREFLAGS values (shellcon.GPS_*) // @pyparm <o PyIID>|riid|IID_IPropertyStore|The interface to return @@ -82,7 +82,27 @@ return PyCom_PyObjectFromIUnknown((IUnknown *)ret, riid); } -/* + +// ??? Also in PyPROPVARIANT.cpp, should move into a header somewhere ??? +// Generic conversion from python sequence to VT_VECTOR array +template <typename arraytype> +BOOL SeqToVector(PyObject *ob, arraytype **pA, ULONG *pcount, BOOL (*converter)(PyObject *, arraytype *)){ + TmpPyObject seq = PyWinSequence_Tuple(ob, pcount); + if (seq == NULL) + return FALSE; + *pA = (arraytype *)CoTaskMemAlloc(*pcount * sizeof(arraytype)); + if (*pA == NULL){ + PyErr_NoMemory(); + return FALSE; + } + for (ULONG i=0; i<*pcount; i++){ + PyObject *item = PyTuple_GET_ITEM((PyObject *)seq, i); + if (!(*converter)(item, &(*pA)[i])) + return FALSE; + } + return TRUE; +} + // @pymethod <o PyIPropertyStore>|PyIShellItem2|GetPropertyStoreForKeys|Creates a property store containing just the specified properties of the item PyObject *PyIShellItem2::GetPropertyStoreForKeys(PyObject *self, PyObject *args) { @@ -90,33 +110,29 @@ if ( pISI2 == NULL ) return NULL; - IUnknown *ret; + void *ret; PROPERTYKEY *pkeys; - UINT ckeys; - PyObject *obkeys; + ULONG ckeys; GETPROPERTYSTOREFLAGS flags = GPS_DEFAULT; IID riid = IID_IPropertyStore; PyObject *obkeys; // @pyparm (<o SHCOLUMNID>,...))|Keys||A sequence of property identifiers // @pyparm int|Flags|GPS_DEFAULT|Combination of GETPROPERTYSTOREFLAGS values (shellcon.GPS_*) // @pyparm <o PyIID>|riid|IID_IPropertyStore|The interface to return - UINT cKeys; if (!PyArg_ParseTuple(args, "O|kO&:GetPropertyStoreForKeys", &obkeys, &flags, PyWinObject_AsIID, &riid)) return NULL; - // ??? no conversion function yet ... ??? - if (!PyWinObject_AsSHCOLUMNIDArray(obkeys, &pkeys, &ckeys)) + if (!SeqToVector(obkeys, &pkeys, &ckeys, PyObject_AsSHCOLUMNID)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; - hr = pISI2->GetPropertyStoreForKeys(pkeys, ckeys, flags, riid, *ret); + hr = pISI2->GetPropertyStoreForKeys(pkeys, ckeys, flags, riid, &ret); PY_INTERFACE_POSTCALL; - PyWinObject_FreeSHCOLUMNIDArray(pkeys); + CoTaskMemFree(pkeys); if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISI2, IID_IShellItem2 ); - return PyCom_PyObjectFromIUnknown(ret, riid); + return PyCom_PyObjectFromIUnknown((IUnknown *)ret, riid); } -*/ // @pymethod <o PyIPropertyDescriptionList>|PyIShellItem2|GetPropertyDescriptionList|Retrieves descriptions of properties in a particular group PyObject *PyIShellItem2::GetPropertyDescriptionList(PyObject *self, PyObject *args) @@ -353,8 +369,8 @@ // @object PyIShellItem2|Extends the IShellItem interface, giving access to an item's properties static struct PyMethodDef PyIShellItem2_methods[] = { - // { "GetPropertyStoreForKeys", PyIShellItem2::GetPropertyStoreForKeys, 1 }, // @pymeth GetPropertyStoreForKeys|Creates a property store containing just the specified properties of the item { "GetPropertyStore", PyIShellItem2::GetPropertyStore, 1 }, // @pymeth GetPropertyStore|Returns a collection of the item's properties + { "GetPropertyStoreForKeys", PyIShellItem2::GetPropertyStoreForKeys, 1 }, // @pymeth GetPropertyStoreForKeys|Creates a property store containing just the specified properties of the item { "GetPropertyStoreWithCreateObject", PyIShellItem2::GetPropertyStoreWithCreateObject, 1 }, // @pymeth GetPropertyStoreWithCreateObject|Returns the property store for the item, with alternate handler instantiation { "GetPropertyDescriptionList", PyIShellItem2::GetPropertyDescriptionList, 1 }, // @pymeth GetPropertyDescriptionList|Retrieves descriptions of properties in a particular group { "Update", PyIShellItem2::Update, 1 }, // @pymeth Update|Refreshes properties that have been modified since interface was created @@ -410,6 +426,7 @@ return hr; } +// ??? Should be able to use VectorToSeq for this ??? PyObject* PyWinObject_FromSHCOLUMNIDArray(const PROPERTYKEY *keys, UINT count) { PyObject *ret = PyList_New(count); |
|
From: <pyw...@li...> - 2012-07-15 16:15:49
|
changeset 60947f18882f in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=60947f18882f summary: Add IShellItem2 diffstat: com/win32comext/shell/shellcon.py | 11 + com/win32comext/shell/src/PyIShellFolder2.cpp | 75 +- com/win32comext/shell/src/PyIShellFolder2.h | 2 +- com/win32comext/shell/src/PyIShellItem2.cpp | 592 ++++++++++++++++++++++++++ com/win32comext/shell/src/PyIShellItem2.h | 124 +++++ com/win32comext/shell/src/shell.cpp | 67 +- setup.py | 1 + 7 files changed, 802 insertions(+), 70 deletions(-) diffs (truncated from 1130 to 300 lines): diff -r 043fe61ee7c0 -r 60947f18882f com/win32comext/shell/shellcon.py --- a/com/win32comext/shell/shellcon.py Mon Jul 09 17:34:43 2012 +1000 +++ b/com/win32comext/shell/shellcon.py Sun Jul 15 10:45:20 2012 -0400 @@ -1233,3 +1233,14 @@ ["GetDefaultSearchGUID", "EnumSearches", "GetDefaultColumn", "GetDefaultColumnState", "GetDetailsEx", "GetDetailsOf", "MapColumnToSCID"] + +## enum GETPROPERTYSTOREFLAGS, used with IShellItem2 methods +GPS_DEFAULT = 0 +GPS_HANDLERPROPERTIESONLY = 0x1 +GPS_READWRITE = 0x2 +GPS_TEMPORARY = 0x4 +GPS_FASTPROPERTIESONLY = 0x8 +GPS_OPENSLOWITEM = 0x10 +GPS_DELAYCREATION = 0x20 +GPS_BESTEFFORT = 0x40 +GPS_MASK_VALID = 0x7f diff -r 043fe61ee7c0 -r 60947f18882f com/win32comext/shell/src/PyIShellFolder2.cpp --- a/com/win32comext/shell/src/PyIShellFolder2.cpp Mon Jul 09 17:34:43 2012 +1000 +++ b/com/win32comext/shell/src/PyIShellFolder2.cpp Sun Jul 15 10:45:20 2012 -0400 @@ -25,7 +25,7 @@ return (IShellFolder2 *)PyIShellFolder::GetI(self); } -// @pymethod |PyIShellFolder2|GetDefaultSearchGUID|Description of GetDefaultSearchGUID. +// @pymethod <o PyIID>|PyIShellFolder2|GetDefaultSearchGUID|Retrieves the default search for the folder PyObject *PyIShellFolder2::GetDefaultSearchGUID(PyObject *self, PyObject *args) { IShellFolder2 *pISF2 = GetI(self); @@ -45,7 +45,8 @@ return PyWinObject_FromIID(guid); } -// @pymethod |PyIShellFolder2|EnumSearches|Description of EnumSearches. +// @pymethod <o PyIEnumExtraSearch>|PyIShellFolder2|EnumSearches|Returns an interface that lists searches defined for the folder +// @comm IEnumExtraSearch is not yet wrapped by Pywin32 PyObject *PyIShellFolder2::EnumSearches(PyObject *self, PyObject *args) { IShellFolder2 *pISF2 = GetI(self); @@ -64,7 +65,7 @@ return PyCom_PyObjectFromIUnknown(penum, IID_IEnumExtraSearch, FALSE); } -// @pymethod |PyIShellFolder2|GetDefaultColumn|Description of GetDefaultColumn. +// @pymethod (int, int)|PyIShellFolder2|GetDefaultColumn|Returns the columns used for sorting and display PyObject *PyIShellFolder2::GetDefaultColumn(PyObject *self, PyObject *args) { IShellFolder2 *pISF2 = GetI(self); @@ -84,15 +85,16 @@ return Py_BuildValue("ii", sort, display); } -// @pymethod |PyIShellFolder2|GetDefaultColumnState|Description of GetDefaultColumnState. +// @pymethod int|PyIShellFolder2|GetDefaultColumnState|Returns flags indicating the default behaviour of the column +// @rdesc Returns a combination of shellcon.SHCOLSTATE_* flags PyObject *PyIShellFolder2::GetDefaultColumnState(PyObject *self, PyObject *args) { IShellFolder2 *pISF2 = GetI(self); if ( pISF2 == NULL ) return NULL; - // @pyparm int|iColumn||Description for iColumn + // @pyparm int|iColumn||Zero-based index of the column UINT iColumn; - if ( !PyArg_ParseTuple(args, "i:GetDefaultColumnState", &iColumn) ) + if ( !PyArg_ParseTuple(args, "k:GetDefaultColumnState", &iColumn) ) return NULL; SHCOLSTATEF flags; HRESULT hr; @@ -104,24 +106,22 @@ return PyLong_FromUnsignedLong(flags); } -// @pymethod |PyIShellFolder2|GetDetailsEx|Description of GetDetailsEx. +// @pymethod object|PyIShellFolder2|GetDetailsEx|Returns the details of an item by Column ID +// @rdesc The type of returned object is determined by the variant type of the requested column PyObject *PyIShellFolder2::GetDetailsEx(PyObject *self, PyObject *args) { IShellFolder2 *pISF2 = GetI(self); if ( pISF2 == NULL ) return NULL; - // @pyparm <o PyIDL>|pidl||Description for pidl + // @pyparm <o PyIDL>|pidl||Relative id list of an item in the folder + // @pyparm <o SHCOLUMNID>|pscid||The Column id/property key of a column in the folder's Details view SHCOLUMNID scid; - PyObject *obpscid; - // @pyparm <o SHCOLUMNID>|pscid||Description for pscid PyObject *obpidl; LPITEMIDLIST pidl; - if ( !PyArg_ParseTuple(args, "OO:GetDetailsEx", &obpidl, &obpscid) ) + if (!PyArg_ParseTuple(args, "OO&:GetDetailsEx", &obpidl, PyObject_AsSHCOLUMNID, &scid)) return NULL; - BOOL bPythonIsHappy = TRUE; - if (bPythonIsHappy && !PyObject_AsPIDL(obpidl, &pidl)) bPythonIsHappy = FALSE; - if (bPythonIsHappy && !PyObject_AsSHCOLUMNID(obpscid, &scid )) bPythonIsHappy = FALSE; - if (!bPythonIsHappy) return NULL; + if (!PyObject_AsPIDL(obpidl, &pidl)) + return NULL; HRESULT hr; VARIANT var; PY_INTERFACE_PRECALL; @@ -136,23 +136,23 @@ return obRet; } -// @pymethod |PyIShellFolder2|GetDetailsOf|Description of GetDetailsOf. +// @pymethod (int, int, str)|PyIShellFolder2|GetDetailsOf|Returns the value or title of a column in the folder's Details view. +// @rdesc Returns a tuple representing a SHELLDETAILS struct, containing the formst (LVCFMT_*), column width in characters, +// and string representation of the requested value PyObject *PyIShellFolder2::GetDetailsOf(PyObject *self, PyObject *args) { IShellFolder2 *pISF2 = GetI(self); if ( pISF2 == NULL ) return NULL; - // @pyparm <o PyIDL>|pidl||Description for pidl - // @pyparm int|iColumn||Description for iColumn + // @pyparm <o PyIDL>|pidl||The relative idl of an item in the folder. Use None to retrieve column title. + // @pyparm int|iColumn||Zero based index of column SHELLDETAILS sd; - // @pyparm <o PySHELLDETAILS>|psd||Description for psd PyObject *obpidl; LPITEMIDLIST pidl; UINT iColumn; - if ( !PyArg_ParseTuple(args, "Oi:GetDetailsOf", &obpidl, &iColumn) ) + if (!PyArg_ParseTuple(args, "Oi:GetDetailsOf", &obpidl, &iColumn)) return NULL; - BOOL bPythonIsHappy = TRUE; - if (!PyObject_AsPIDL(obpidl, &pidl)) + if (!PyObject_AsPIDL(obpidl, &pidl, TRUE)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; @@ -161,16 +161,18 @@ PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISF2, IID_IShellFolder2 ); - return Py_BuildValue("((iiN))", sd.fmt, sd.cxChar, PyObject_FromSTRRET(&sd.str, pidl, TRUE)); + return Py_BuildValue("(iiN)", sd.fmt, sd.cxChar, PyObject_FromSTRRET(&sd.str, pidl, TRUE)); } -// @pymethod |PyIShellFolder2|MapColumnToSCID|Description of MapColumnToSCID. +// @pymethod <o SHCOLUMNID>|PyIShellFolder2|MapColumnToSCID|Returns the unique identifier (FMTID, pid) of a column +// @rdesc On XP and earlier, this is the Column Id as provided by <o PyIColumnProvider>. +// For Vista and later, this is the Property Key used with the property system interfaces. PyObject *PyIShellFolder2::MapColumnToSCID(PyObject *self, PyObject *args) { IShellFolder2 *pISF2 = GetI(self); if ( pISF2 == NULL ) return NULL; - // @pyparm int|iColumn||Description for iColumn + // @pyparm int|Column||The zero-based index of the column as presented by the folder's Details view SHCOLUMNID scid; UINT iColumn; if ( !PyArg_ParseTuple(args, "i:MapColumnToSCID", &iColumn) ) @@ -184,24 +186,27 @@ return PyObject_FromSHCOLUMNID(&scid); } -// @object PyIShellFolder2|Description of the interface +// @object PyIShellFolder2|Represents an explorer folder, giving access to details of items in the folder. +// Inherits all methods of <o PyIShellFolder>. static struct PyMethodDef PyIShellFolder2_methods[] = { - { "GetDefaultSearchGUID", PyIShellFolder2::GetDefaultSearchGUID, 1 }, // @pymeth GetDefaultSearchGUID|Description of GetDefaultSearchGUID - { "EnumSearches", PyIShellFolder2::EnumSearches, 1 }, // @pymeth EnumSearches|Description of EnumSearches - { "GetDefaultColumn", PyIShellFolder2::GetDefaultColumn, 1 }, // @pymeth GetDefaultColumn|Description of GetDefaultColumn - { "GetDefaultColumnState", PyIShellFolder2::GetDefaultColumnState, 1 }, // @pymeth GetDefaultColumnState|Description of GetDefaultColumnState - { "GetDetailsEx", PyIShellFolder2::GetDetailsEx, 1 }, // @pymeth GetDetailsEx|Description of GetDetailsEx - { "GetDetailsOf", PyIShellFolder2::GetDetailsOf, 1 }, // @pymeth GetDetailsOf|Description of GetDetailsOf - { "MapColumnToSCID", PyIShellFolder2::MapColumnToSCID, 1 }, // @pymeth MapColumnToSCID|Description of MapColumnToSCID + { "GetDefaultSearchGUID", PyIShellFolder2::GetDefaultSearchGUID, 1 }, // @pymeth GetDefaultSearchGUID|Retrieves the default search for the folder + { "EnumSearches", PyIShellFolder2::EnumSearches, 1 }, // @pymeth EnumSearches|Returns an interface that lists searches defined for the folder + { "GetDefaultColumn", PyIShellFolder2::GetDefaultColumn, 1 }, // @pymeth GetDefaultColumn|Returns the columns used for sorting and display + { "GetDefaultColumnState", PyIShellFolder2::GetDefaultColumnState, 1 }, // @pymeth GetDefaultColumnState|Returns flags indicating the default behaviour of the column + { "GetDetailsEx", PyIShellFolder2::GetDetailsEx, 1 }, // @pymeth GetDetailsEx|Returns the details of an item by Column ID + { "GetDetailsOf", PyIShellFolder2::GetDetailsOf, 1 }, // @pymeth GetDetailsOf|Returns the value or title of a column in the folder's Details view. + { "MapColumnToSCID", PyIShellFolder2::MapColumnToSCID, 1 }, // @pymeth MapColumnToSCID|Returns the unique identifier (FMTID, pid) of a column { NULL } }; -PyComTypeObject PyIShellFolder2::type("PyIShellFolder2", +// @pymeth __iter__|Enumerates all objects in this folder. +PyComEnumProviderTypeObject PyIShellFolder2::type("PyIShellFolder2", &PyIShellFolder::type, sizeof(PyIShellFolder2), PyIShellFolder2_methods, - GET_PYCOM_CTOR(PyIShellFolder2)); + GET_PYCOM_CTOR(PyIShellFolder2), + "EnumObjects"); // --------------------------------------------------- // // Gateway Implementation diff -r 043fe61ee7c0 -r 60947f18882f com/win32comext/shell/src/PyIShellFolder2.h --- a/com/win32comext/shell/src/PyIShellFolder2.h Mon Jul 09 17:34:43 2012 +1000 +++ b/com/win32comext/shell/src/PyIShellFolder2.h Sun Jul 15 10:45:20 2012 -0400 @@ -9,7 +9,7 @@ public: MAKE_PYCOM_CTOR(PyIShellFolder2); static IShellFolder2 *GetI(PyObject *self); - static PyComTypeObject type; + static PyComEnumProviderTypeObject type; // The Python methods static PyObject *GetDefaultSearchGUID(PyObject *self, PyObject *args); diff -r 043fe61ee7c0 -r 60947f18882f com/win32comext/shell/src/PyIShellItem2.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com/win32comext/shell/src/PyIShellItem2.cpp Sun Jul 15 10:45:20 2012 -0400 @@ -0,0 +1,592 @@ +// This file implements the IShellItem2 Interface and Gateway for Python. +// Generated by makegw.py + +#include "shell_pch.h" +#include "PyIShellItem.h" +#include "PyIShellItem2.h" + +// @doc - This file contains autoduck documentation +// --------------------------------------------------- +// +// Interface Implementation + +PyIShellItem2::PyIShellItem2(IUnknown *pdisp): + PyIShellItem(pdisp) +{ + ob_type = &type; +} + +PyIShellItem2::~PyIShellItem2() +{ +} + +/* static */ IShellItem2 *PyIShellItem2::GetI(PyObject *self) +{ + return (IShellItem2 *)PyIShellItem::GetI(self); +} + +// @pymethod <o PyIPropertyStore>|PyIShellItem2|GetPropertyStore|Returns a collection of the item's properties +PyObject *PyIShellItem2::GetPropertyStore(PyObject *self, PyObject *args) +{ + IShellItem2 *pISI2 = GetI(self); + if ( pISI2 == NULL ) + return NULL; + + void *ret; + GETPROPERTYSTOREFLAGS flags; + IID riid = IID_IPropertyStore; + // @pyparm int|Flags|GPS_DEFAULT|Combination of GETPROPERTYSTOREFLAGS values (shellcon.GPS_*) + // @pyparm <o PyIID>|riid|IID_IPropertyStore|The interface to return + if ( !PyArg_ParseTuple(args, "|kO&:GetPropertyStore", &flags, PyWinObject_AsIID, &riid)) + return NULL; + + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pISI2->GetPropertyStore( flags, riid, &ret); + PY_INTERFACE_POSTCALL; + + if ( FAILED(hr) ) + return PyCom_BuildPyException(hr, pISI2, IID_IShellItem2 ); + return PyCom_PyObjectFromIUnknown((IUnknown *)ret, riid); +} + +// @pymethod <o PyIPropertyStore>|PyIShellItem2|GetPropertyStoreWithCreateObject|Returns the property store for the item, with alternate handler instantiation +// @comm Primarily used to create a handler in a separate process with reduced privileges +PyObject *PyIShellItem2::GetPropertyStoreWithCreateObject(PyObject *self, PyObject *args) +{ + IShellItem2 *pISI2 = GetI(self); + if ( pISI2 == NULL ) + return NULL; + + void *ret; + GETPROPERTYSTOREFLAGS flags; + IUnknown *punkCreateObject; + PyObject *obCreateObject; + IID riid = IID_IPropertyStore; + // @pyparm int|Flags||Combination of GETPROPERTYSTOREFLAGS values (shellcon.GPS_*) + // @pyparm <o PyIUnknown>|CreateObject||An interface that implements ICreateObject, used to create the property handler + // @pyparm <o PyIID>|riid|IID_IPropertyStore|The interface to be created + if ( !PyArg_ParseTuple(args, "kO|O&:GetPropertyStoreWithCreateObject", &flags, + &obCreateObject, PyWinObject_AsIID, &riid)) + return NULL; + if (!PyCom_InterfaceFromPyObject(obCreateObject, IID_IUnknown, (void **)&punkCreateObject)) + return NULL; + + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pISI2->GetPropertyStoreWithCreateObject( flags, punkCreateObject, riid, &ret); + PY_INTERFACE_POSTCALL; + + if ( FAILED(hr) ) + return PyCom_BuildPyException(hr, pISI2, IID_IShellItem2 ); + return PyCom_PyObjectFromIUnknown((IUnknown *)ret, riid); +} + +/* +// @pymethod <o PyIPropertyStore>|PyIShellItem2|GetPropertyStoreForKeys|Creates a property store containing just the specified properties of the item +PyObject *PyIShellItem2::GetPropertyStoreForKeys(PyObject *self, PyObject *args) +{ + IShellItem2 *pISI2 = GetI(self); + if ( pISI2 == NULL ) + return NULL; + |
|
From: <pyw...@li...> - 2012-07-09 07:34:52
|
changeset 043fe61ee7c0 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=043fe61ee7c0 summary: add notes on recent changes diffstat: CHANGES.txt | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diffs (36 lines): diff -r 16707e6f1624 -r 043fe61ee7c0 CHANGES.txt --- a/CHANGES.txt Mon Jul 09 17:04:08 2012 +1000 +++ b/CHANGES.txt Mon Jul 09 17:34:43 2012 +1000 @@ -4,6 +4,32 @@ hg log -rb2xx: > log.out However contributors are encouraged to add their own entries for their work. +Since build 217: +---------------- +* Fix the count of replaced terms in Pythonwin's search/replace (rupole). + +* Fix obscure issues in the Pythonwin code browser and other uses of the + "hierlist" widget (rupole). + +* Fix a crash using a COM "record" that holds an array (rupole). + +* Fix error return in win32gui.GetClassName (rupole). + +* Some misc fixed to win32timezone (Jason R. Coombs). + +* Some fixes to win32com gencache for Python 3.x (Tim Golden) + +* Fix ActiveScript exception hresults. + +* RegQueryValueEx now return an empty list for blank REG_MULTI_SZ + (rupole via bug #3531456) + +* Add win32pdh.AddEnglishCounter (rupole via feature request #3529527) + +* Fix post_install script use of the registry (rupole via bug #3536122) + +* Python 3.3 version is built with VS2010. + Since build 216: ---------------- * ISAPI extension works with Python 3.x |
|
From: <pyw...@li...> - 2012-07-09 07:04:36
|
changeset 490c80b1b8ce in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=490c80b1b8ce summary: add a struct without a GUID to the pycom test object changeset 1a053eff8b4a in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=1a053eff8b4a summary: fix check for null guid when generating support code for structs changeset 16707e6f1624 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=16707e6f1624 summary: various hacks to get Python 3.3 support building with vs2010 diffstat: Pythonwin/Scintilla/win32/scintilla_vc6.mak | 2 +- com/TestSources/PyCOMTest/PyCOMTest.idl | 5 + com/win32com/__init__.py | 5 +- com/win32com/client/genpy.py | 4 +- pywin32_postinstall.py | 6 +- setup.py | 46 ++++++++---- win32/PythonService EXE.dsp | 103 ---------------------------- 7 files changed, 47 insertions(+), 124 deletions(-) diffs (281 lines): diff -r c71db94c80b4 -r 16707e6f1624 Pythonwin/Scintilla/win32/scintilla_vc6.mak --- a/Pythonwin/Scintilla/win32/scintilla_vc6.mak Thu Jun 21 20:49:58 2012 -0400 +++ b/Pythonwin/Scintilla/win32/scintilla_vc6.mak Mon Jul 09 17:04:08 2012 +1000 @@ -42,7 +42,7 @@ CXXNDEBUG=-O1 -MT -DNDEBUG NAME=-Fo # If you have problems with lexers being linked, try removing -OPT:REF and replacing with -OPT:NOREF -LDFLAGS=-OPT:NOWIN98 -OPT:REF +#LDFLAGS=-OPT:NOWIN98 -OPT:REF LDDEBUG= LIBS=KERNEL32.lib USER32.lib GDI32.lib IMM32.lib OLE32.LIB NOLOGO=-nologo diff -r c71db94c80b4 -r 16707e6f1624 com/TestSources/PyCOMTest/PyCOMTest.idl --- a/com/TestSources/PyCOMTest/PyCOMTest.idl Thu Jun 21 20:49:58 2012 -0400 +++ b/com/TestSources/PyCOMTest/PyCOMTest.idl Mon Jul 09 17:04:08 2012 +1000 @@ -84,6 +84,11 @@ int int_value; BSTR str_value; } TestStruct1; + typedef [version(1.0)] + struct tagStructWithoutUUID { + int int_value; + BSTR str_value; + } StructWithoutUUID; // Test enumerators. [ diff -r c71db94c80b4 -r 16707e6f1624 com/win32com/__init__.py --- a/com/win32com/__init__.py Thu Jun 21 20:49:58 2012 -0400 +++ b/com/win32com/__init__.py Mon Jul 09 17:04:08 2012 +1000 @@ -87,7 +87,10 @@ if not __gen_path__: try: import win32com.gen_py - __gen_path__ = sys.modules["win32com.gen_py"].__path__[0] + # hrmph - 3.3 throws: TypeError: '_NamespacePath' object does not support indexing + # attempting to get __path__[0] - but I can't quickly repro this stand-alone. + # Work around it by using an iterator. + __gen_path__ = next(iter(sys.modules["win32com.gen_py"].__path__)) except ImportError: # If a win32com\gen_py directory already exists, then we use it # (gencache doesn't insist it have an __init__, but our __import__ diff -r c71db94c80b4 -r 16707e6f1624 com/win32com/client/genpy.py --- a/com/win32com/client/genpy.py Thu Jun 21 20:49:58 2012 -0400 +++ b/com/win32com/client/genpy.py Mon Jul 09 17:04:08 2012 +1000 @@ -896,8 +896,8 @@ 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" % (repr(record.doc[0]), repr(str(record.clsid))) + if record.clsid == pythoncom.IID_NULL: + print >> stream, "\t###%s: %s, # Record disabled because it doesn't have a non-null GUID" % (repr(record.doc[0]), repr(str(record.clsid))) else: print >> stream, "\t%s: %s," % (repr(record.doc[0]), repr(str(record.clsid))) print >> stream, "}" diff -r c71db94c80b4 -r 16707e6f1624 pywin32_postinstall.py --- a/pywin32_postinstall.py Thu Jun 21 20:49:58 2012 -0400 +++ b/pywin32_postinstall.py Mon Jul 09 17:04:08 2012 +1000 @@ -455,8 +455,12 @@ mfc_dll = "mfc42.dll" elif sys.hexversion < 0x2060000: mfc_dll = "mfc71.dll" + elif sys.hexversion < 0x2070000: + mfc_dll = "mfc90.dll" + elif sys.hexversion < 0x3000000: + mfc_dll = "mfc90u.dll" else: - mfc_dll = "mfc90.dll" + mfc_dll = "mfc100u.dll" try: # It might be next to pythonwin itself (which is where setup.py # currently arranges for it to be installed...) diff -r c71db94c80b4 -r 16707e6f1624 setup.py --- a/setup.py Thu Jun 21 20:49:58 2012 -0400 +++ b/setup.py Mon Jul 09 17:04:08 2012 +1000 @@ -1,4 +1,4 @@ -build_id="217" # may optionally include a ".{patchno}" suffix. +build_id="217.1" # may optionally include a ".{patchno}" suffix. # Putting buildno at the top prevents automatic __doc__ assignment, and # I *want* the build number at the top :) __doc__="""This is a distutils setup-script for the pywin32 extensions @@ -295,10 +295,12 @@ break def monkeypatched_link(self, target_desc, objects, output_filename, *args, **kw): - self._want_assembly_kept = os.path.basename(output_filename).startswith("PyISAPI_loader.dll") or \ - os.path.basename(output_filename).startswith("perfmondata.dll") or \ - os.path.basename(output_filename).startswith("win32ui.pyd") or \ - target_desc==self.EXECUTABLE + # no manifests for 3.3+ + self._want_assembly_kept = sys.version_info < (3,3) and \ + (os.path.basename(output_filename).startswith("PyISAPI_loader.dll") or \ + os.path.basename(output_filename).startswith("perfmondata.dll") or \ + os.path.basename(output_filename).startswith("win32ui.pyd") or \ + target_desc==self.EXECUTABLE) try: return self._orig_link(target_desc, objects, output_filename, *args, **kw) finally: @@ -985,9 +987,10 @@ largs.append("/IMPLIB:" + os.path.join(build_temp, "PythonCOMLoader"+suffix+".lib")) largs.append(obj) self.spawn(largs) - # and the manifest - out_arg = '-outputresource:%s;2' % (dll,) - self.spawn(['mt.exe', '-nologo', '-manifest', temp_manifest, out_arg]) + # and the manifest if one exists. + if os.path.isfile(temp_manifest): + out_arg = '-outputresource:%s;2' % (dll,) + self.spawn(['mt.exe', '-nologo', '-manifest', temp_manifest, out_arg]) def build_extensions(self): # First, sanity-check the 'extensions' list @@ -1033,7 +1036,7 @@ # Not sure how to make this completely generic, and there is no # need at this stage. - if sys.version_info > (2,6): + if sys.version_info > (2,6) and sys.version_info < (3, 3): # only stuff built with msvc9 needs this loader. self._build_pycom_loader() self._build_scintilla() @@ -1066,25 +1069,35 @@ raise RuntimeError("Can't find %r" % (src,)) self.copy_file(src, target_dir) else: + # vs2008 or vs2010 + if sys.hexversion < 0x3030000: + product_key = r"SOFTWARE\Microsoft\VisualStudio\9.0\Setup\VC" + plat_dir_64 = "amd64" + mfc_dir = "Microsoft.VC90.MFC" + mfc_files = "mfc90.dll mfc90u.dll mfcm90.dll mfcm90u.dll Microsoft.VC90.MFC.manifest".split() + else: + product_key = r"SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VC" + plat_dir_64 = "x64" + mfc_dir = "Microsoft.VC100.MFC" + mfc_files = ["mfc100u.dll", "mfcm100u.dll"] + # On a 64bit host, the value we are looking for is actually in # SysWow64Node - but that is only available on xp and later. access = _winreg.KEY_READ if sys.getwindowsversion()[0] >= 5: access = access | 512 # KEY_WOW64_32KEY if self.plat_name == 'win-amd64': - plat_dir = "amd64" + plat_dir = plat_dir_64 else: plat_dir = "x86" # Find the redist directory. - vckey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, - r"SOFTWARE\Microsoft\VisualStudio\9.0\Setup\VC", + vckey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, product_key, 0, access) val, val_typ = _winreg.QueryValueEx(vckey, "ProductDir") - mfc_dir = os.path.join(val, "redist", plat_dir, "Microsoft.VC90.MFC") + mfc_dir = os.path.join(val, "redist", plat_dir, mfc_dir) if not os.path.isdir(mfc_dir): raise RuntimeError("Can't find the redist dir at %r" % (mfc_dir)) - files = "mfc90.dll mfc90u.dll mfcm90.dll mfcm90u.dll Microsoft.VC90.MFC.manifest".split() - for f in files: + for f in mfc_files: self.copy_file( os.path.join(mfc_dir, f), target_dir) except (EnvironmentError, RuntimeError), exc: @@ -2144,7 +2157,8 @@ W32_exe_files = [ WinExt_win32("pythonservice", - dsp_file = "win32/PythonService EXE.dsp", + sources=[os.path.join("win32", "src", s) for s in + "PythonService.cpp PythonService.rc".split()], unicode_mode = True, extra_link_args=["/SUBSYSTEM:CONSOLE"], libraries = "user32 advapi32 ole32 shell32"), diff -r c71db94c80b4 -r 16707e6f1624 win32/PythonService EXE.dsp --- a/win32/PythonService EXE.dsp Thu Jun 21 20:49:58 2012 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -# Microsoft Developer Studio Project File - Name="PythonService EXE" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=PythonService EXE - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "PythonService EXE.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "PythonService EXE.mak" CFG="PythonService EXE - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "PythonService EXE - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "PythonService EXE - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName ""$/win32", YFAAAAAA" -# PROP Scc_LocalPath "." -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "PythonService EXE - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Build" -# PROP BASE Intermediate_Dir "Build\Temp\PythonService EXE\Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Build" -# PROP Intermediate_Dir "Build\Temp\PythonServiceExe\Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /Zi /O2 /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_WINDOWS" /D "__WIN32__" /D "NDEBUG" /D "STRICT" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" -# ADD BASE RSC /l 0xc09 /d "NDEBUG" -# ADD RSC /l 0xc09 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 Advapi32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Build\PythonService.exe" /implib:"Build\PythonService_exe.lib" /libpath:"./Build" -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "PythonService EXE - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Build" -# PROP BASE Intermediate_Dir "Build\Temp\PythonService EXE\Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Build" -# PROP Intermediate_Dir "Build\Temp\PythonServiceExe\Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -F90=df.exe -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "_WINDOWS" /D "__WIN32__" /D "_DEBUG" /D "STRICT" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" -# ADD BASE RSC /l 0xc09 /d "_DEBUG" -# ADD RSC /l 0xc09 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 Advapi32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Build\PythonService_d.exe" /pdbtype:sept /libpath:".\Build" -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "PythonService EXE - Win32 Release" -# Name "PythonService EXE - Win32 Debug" -# Begin Source File - -SOURCE=.\src\PythonService.cpp -# End Source File -# Begin Source File - -SOURCE=.\src\PythonService.rc -# End Source File -# End Target -# End Project |
|
From: <pyw...@li...> - 2012-06-22 00:52:50
|
changeset c71db94c80b4 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=c71db94c80b4 summary: Add missing 3rd arg to OpenKey (bug #3536122) diffstat: pywin32_postinstall.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 153ff53992c6 -r c71db94c80b4 pywin32_postinstall.py --- a/pywin32_postinstall.py Mon Jun 04 18:58:32 2012 -0400 +++ b/pywin32_postinstall.py Thu Jun 21 20:49:58 2012 -0400 @@ -63,7 +63,7 @@ def get_root_hkey(): try: winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, - root_key_name, winreg.KEY_CREATE_SUB_KEY) + root_key_name, 0, winreg.KEY_CREATE_SUB_KEY) return winreg.HKEY_LOCAL_MACHINE except OSError, details: # Either not exist, or no permissions to create subkey means |
|
From: <pyw...@li...> - 2012-06-04 22:59:57
|
changeset 153ff53992c6 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=153ff53992c6 summary: Feature req #3529527 (AddEnglishCounter) diffstat: win32/src/win32pdhmodule.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 46 insertions(+), 1 deletions(-) diffs (85 lines): diff -r 58aabb12a580 -r 153ff53992c6 win32/src/win32pdhmodule.cpp --- a/win32/src/win32pdhmodule.cpp Mon Jun 04 18:43:08 2012 -0400 +++ b/win32/src/win32pdhmodule.cpp Mon Jun 04 18:58:32 2012 -0400 @@ -157,7 +157,7 @@ LPDWORD pcchBuffer ); -#define CHECK_PDH_PTR(ptr) if((ptr)==NULL) { PyErr_SetString(PyExc_RuntimeError, "The pdh.dll entry point functions could not be loaded."); return NULL;} +#define CHECK_PDH_PTR(ptr) if((ptr)==NULL) { PyErr_Format(PyExc_RuntimeError, "The pdh.dll entry point function %s could not be loaded.", #ptr); return NULL;} // The function pointers FuncPdhEnumObjects pPdhEnumObjects = NULL; @@ -166,6 +166,7 @@ FuncPdhCloseQuery pPdhCloseQuery = NULL; FuncPdhRemoveCounter pPdhRemoveCounter = NULL; FuncPdhAddCounter pPdhAddCounter = NULL; +FuncPdhAddCounter pPdhAddEnglishCounter = NULL; FuncPdhMakeCounterPath pPdhMakeCounterPath = NULL; FuncPdhGetCounterInfo pPdhGetCounterInfo = NULL; FuncPdhGetFormattedCounterValue pPdhGetFormattedCounterValue = NULL; @@ -222,6 +223,7 @@ pPdhRemoveCounter = (FuncPdhRemoveCounter)GetProcAddress(handle, "PdhRemoveCounter"); pPdhOpenQuery = (FuncPdhOpenQuery)GetProcAddress(handle, "PdhOpenQuery" A_OR_W); pPdhAddCounter = (FuncPdhAddCounter)GetProcAddress(handle, "PdhAddCounter" A_OR_W); + pPdhAddEnglishCounter = (FuncPdhAddCounter)GetProcAddress(handle, "PdhAddEnglishCounter" A_OR_W); pPdhMakeCounterPath = (FuncPdhMakeCounterPath)GetProcAddress(handle, "PdhMakeCounterPath" A_OR_W); pPdhGetCounterInfo = (FuncPdhGetCounterInfo)GetProcAddress(handle, "PdhGetCounterInfo" A_OR_W); pPdhGetFormattedCounterValue = (FuncPdhGetFormattedCounterValue)GetProcAddress(handle, "PdhGetFormattedCounterValue"); @@ -453,6 +455,48 @@ return PyWinLong_FromHANDLE(hCounter); } +// @pymethod int|win32pdh|AddEnglishCounter|Adds a counter to a query by its English name +// @comm Available on Vista and later +// @rdesc Returns a handle to the counter +static PyObject *PyAddEnglishCounter(PyObject *self, PyObject *args) +{ + HQUERY hQuery; + PyObject *obhQuery; + PyObject *obPath; + PyObject *obuserData = Py_None; // Might make more sense to use actual PyObject for userData + DWORD_PTR userData = 0; + CHECK_PDH_PTR(pPdhAddEnglishCounter); + PDH_STATUS pdhStatus; + if (!PyArg_ParseTuple(args, "OO|O:AddEnglishCounter", + &obhQuery, // @pyparm int|hQuery||Handle to an open query. + &obPath, // @pyparm string|path||Full counter path with standard English names. + &obuserData)) // @pyparm int|userData|0|User data associated with the counter. + return NULL; + if (!PyWinObject_AsHANDLE(obhQuery, &hQuery)) + return NULL; + if (obuserData != Py_None) + if (!PyWinLong_AsDWORD_PTR(obuserData, &userData)) + return NULL; + TCHAR *szPath; + if (!PyWinObject_AsTCHAR(obPath, &szPath, FALSE)) + return NULL; + HCOUNTER hCounter; + + Py_BEGIN_ALLOW_THREADS + pdhStatus = (*pPdhAddEnglishCounter) ( + hQuery, + szPath, + userData, + &hCounter); + + Py_END_ALLOW_THREADS; + PyWinObject_FreeTCHAR(szPath); + if (pdhStatus != ERROR_SUCCESS) + return PyWin_SetAPIError("AddEnglishCounter", pdhStatus); + // @comm See also <om win32pdh.RemoveCounter> + return PyWinLong_FromHANDLE(hCounter); +} + // @pymethod |win32pdh|RemoveCounter|Removes a previously opened counter static PyObject *PyRemoveCounter(PyObject *self, PyObject *args) { @@ -1185,6 +1229,7 @@ // @module win32pdh|A module, encapsulating the Windows Performance Data Helpers API static struct PyMethodDef win32pdh_functions[] = { {"AddCounter", PyAddCounter, 1}, // @pymeth AddCounter|Adds a new counter + {"AddEnglishCounter", PyAddEnglishCounter, 1}, // @pymeth AddEnglishCounter|Adds a counter to a query by its English name {"RemoveCounter", PyRemoveCounter, 1}, // @pymeth RemoveCounter|Removes an open counter. {"EnumObjectItems", PyEnumObjectItems, 1}, // @pymeth EnumObjectItems|Enumerates an object's items {"EnumObjects", PyEnumObjects, 1}, // @pymeth EnumObjects|Enumerates objects |
|
From: <pyw...@li...> - 2012-06-04 22:48:39
|
changeset 58aabb12a580 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=58aabb12a580 summary: Bug #3531456 - RegQueryValueEx should return an empty list for blank REG_MULTI_SZ diffstat: win32/src/win32apimodule.cpp | 3 ++- win32/test/test_win32api.py | 1 + 2 files changed, 3 insertions(+), 1 deletions(-) diffs (24 lines): diff -r b8c62cf04c5a -r 58aabb12a580 win32/src/win32apimodule.cpp --- a/win32/src/win32apimodule.cpp Sun May 13 17:42:31 2012 -0400 +++ b/win32/src/win32apimodule.cpp Mon Jun 04 18:43:08 2012 -0400 @@ -3613,7 +3613,8 @@ } case REG_MULTI_SZ:{ obData = PyList_New(0); - if ((obData==NULL) || (retDataSize==0)) + if ((obData==NULL) || (retDataSize==0) || + (retDataSize == sizeof(TCHAR) && *(TCHAR *)retDataBuf == 0)) break; TCHAR *curr_str, *curr_char, *end_char; curr_str=(TCHAR *)retDataBuf; diff -r b8c62cf04c5a -r 58aabb12a580 win32/test/test_win32api.py --- a/win32/test/test_win32api.py Sun May 13 17:42:31 2012 -0400 +++ b/win32/test/test_win32api.py Mon Jun 04 18:43:08 2012 -0400 @@ -69,6 +69,7 @@ ('REG_EXPAND_SZ', win32con.REG_EXPAND_SZ, '%systemdir%'), ## REG_MULTI_SZ value needs to be a list since strings are returned as a list ('REG_MULTI_SZ', win32con.REG_MULTI_SZ, ['string 1','string 2','string 3','string 4']), + ('REG_MULTI_SZ_empty', win32con.REG_MULTI_SZ, []), ('REG_DWORD', win32con.REG_DWORD, 666), ('REG_BINARY', win32con.REG_BINARY, str2bytes('\x00\x01\x02\x03\x04\x05\x06\x07\x08\x01\x00')), ) |
|
From: <pyw...@li...> - 2012-05-13 21:42:57
|
changeset b8c62cf04c5a in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=b8c62cf04c5a summary: Backed out changeset: ba623bb65a7b diffstat: win32/Lib/win32timezone.py | 41 +---------------------------------------- 1 files changed, 1 insertions(+), 40 deletions(-) diffs (85 lines): diff -r 93b87a416b72 -r b8c62cf04c5a win32/Lib/win32timezone.py --- a/win32/Lib/win32timezone.py Sat May 12 13:46:28 2012 +1000 +++ b/win32/Lib/win32timezone.py Sun May 13 17:42:31 2012 -0400 @@ -202,8 +202,6 @@ datetime.datetime(2011, 11, 5, 19, 0, tzinfo=TimeZoneInfo('Pacific Standard Time')) Make sure the converted time is correct. ->>> tz_pac -TimeZoneInfo('Pacific Standard Time') >>> dt_pac = dt_hi.astimezone(tz_pac) >>> dt_pac.timetuple() time.struct_time(tm_year=2011, tm_mon=11, tm_mday=5, tm_hour=19, tm_min=0, tm_sec=0, tm_wday=5, tm_yday=309, tm_isdst=1) @@ -226,31 +224,13 @@ >>> (offset + dst_offset) == datetime.timedelta(hours=-7) True + Test offsets that occur right at the DST changeover >>> datetime.datetime.utcfromtimestamp(1320570000).replace( ... tzinfo=TimeZoneInfo.utc()).astimezone(tz_pac) datetime.datetime(2011, 11, 6, 1, 0, tzinfo=TimeZoneInfo('Pacific Standard Time')) -TimeZoneInfo now raises AmbiguousTimeError for ambiguous times -============================================================== - -Is 1:15 the first one, or the one after clocks were set back? ->>> ambiguous = datetime.datetime(2011, 11, 6, 1, 15) ->>> est = TimeZoneInfo('Eastern Standard Time') ->>> est.dst(ambiguous) -Traceback (most recent call last): -[...] -AmbiguousTimeError: 2011-11-06 01:15:00 ->>> est.utcoffset(ambiguous) -Traceback (most recent call last): -[...] -AmbiguousTimeError: 2011-11-06 01:15:00 - -However, if we're converting from UTC, it's not ambiguous. ->>> datetime.datetime(2011, 11, 6, 6, 0, tzinfo=TimeZoneInfo.utc()).astimezone(est) -datetime.datetime(2011, 11, 6, 1, 0, tzinfo=TimeZoneInfo('Eastern Standard Time')) """ - from __future__ import generators __author__ = 'Jason R. Coombs <ja...@ja...>' @@ -615,19 +595,6 @@ winInfo = self.getWinInfo(dt.year) return winInfo.bias + winInfo.daylight_bias - def fromutc(self, dt): - if dt.tzinfo is not self: - raise ValueError("tzinfo is not self") - # calculate the local time using the standard offset - tz_std = TimeZoneInfo(self.timeZoneName, fix_standard_time=True) - delta = tz_std.utcoffset(dt) - dt += delta - try: - dt += self.dst(dt) - except AmbiguousTimeError: - pass - return dt - def utcoffset(self, dt): "Calculates the utcoffset according to the datetime.tzinfo spec" if dt is None: return @@ -660,9 +627,6 @@ # if there's a standard_bias (which I suspect is always 0). dstStartAdj = dstStart + winInfo.standard_bias - if dstEndAdj <= dt < dstEnd or dstStartAdj <= dt < dstStart: - raise AmbiguousTimeError(dt) - if dstStart < dstEnd: in_dst = dstStartAdj <= dt < dstEndAdj else: @@ -841,9 +805,6 @@ GetSortedTimeZoneNames = deprecated(TimeZoneInfo.get_sorted_time_zone_names, 'GetSortedTimeZoneNames') # end backward compatibility -class AmbiguousTimeError(Exception): - pass - def utcnow(): """ Return the UTC time now with timezone awareness as enabled |
|
From: <pyw...@li...> - 2012-05-12 03:48:31
|
changeset 49afc629bc10 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=49afc629bc10 summary: Check for archive before assuming the module is readonly changeset 988fea031f18 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=988fea031f18 summary: Ensure attribute names are correctly converted for Python 3.x changeset dc6d198349c1 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=dc6d198349c1 summary: fix issues with the new import mechanism changeset 0250f408b69b in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=0250f408b69b summary: fix for new import mechanism changeset f67da355ef8b in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=f67da355ef8b summary: another fix for FileLists changeset 93b87a416b72 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=93b87a416b72 summary: Correct arguments to Exception object in active script exception handlers diffstat: com/win32com/client/gencache.py | 4 ++-- com/win32comext/adsi/src/PyIADs.cpp | 2 +- com/win32comext/axscript/client/framework.py | 6 +++--- pywin32_postinstall.py | 3 +-- setup.py | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-) diffs (84 lines): diff -r 70123c669c9e -r 93b87a416b72 com/win32com/client/gencache.py --- a/com/win32com/client/gencache.py Thu May 10 09:09:42 2012 -0400 +++ b/com/win32com/client/gencache.py Sat May 12 13:46:28 2012 +1000 @@ -42,7 +42,7 @@ # a "__loader__" attribute, so we use that. # (Later, it may become necessary to check if the __loader__ can update files, # as a .zip loader potentially could - but punt all that until a need arises) -is_readonly = hasattr(win32com, "__loader__") +is_readonly = is_zip = hasattr(win32com, "__loader__") and hasattr(win32com.__loader__, "archive") # A dictionary of ITypeLibrary objects for demand generation explicitly handed to us # Keyed by usual clsid, lcid, major, minor @@ -72,7 +72,7 @@ def _LoadDicts(): # Load the dictionary from a .zip file if that is where we live. - if hasattr(win32com, "__loader__"): + if is_zip: import cStringIO as io loader = win32com.__loader__ arc_path = loader.archive diff -r 70123c669c9e -r 93b87a416b72 com/win32comext/adsi/src/PyIADs.cpp --- a/com/win32comext/adsi/src/PyIADs.cpp Thu May 10 09:09:42 2012 -0400 +++ b/com/win32comext/adsi/src/PyIADs.cpp Sat May 12 13:46:28 2012 +1000 @@ -257,7 +257,7 @@ PyObject* PyIADs_getattro(PyObject *ob, PyObject *obname) { - char *name = PyString_AsString(obname); + char *name = PYWIN_ATTR_CONVERT(obname); if (!name) return NULL; IADs *p = PyIADs::GetI(ob); diff -r 70123c669c9e -r 93b87a416b72 com/win32comext/axscript/client/framework.py --- a/com/win32comext/axscript/client/framework.py Thu May 10 09:09:42 2012 -0400 +++ b/com/win32comext/axscript/client/framework.py Sat May 12 13:46:28 2012 +1000 @@ -99,7 +99,7 @@ """ print "**************** ASSERTION FAILED *******************" print desc - raise Exception(scode, desc) + raise Exception(desc, scode) class AXScriptCodeBlock: """An object which represents a chunk of code in an AX Script @@ -966,11 +966,11 @@ def BeginScriptedSection(self): if self.scriptSite is None: - raise Exception(E_UNEXPECTED) + raise Exception(scode=winerror.E_UNEXPECTED) self.scriptSite.OnEnterScript() def EndScriptedSection(self): if self.scriptSite is None: - raise Exception(E_UNEXPECTED) + raise Exception(scode=winerror.E_UNEXPECTED) self.scriptSite.OnLeaveScript() def DisableInterrupts(self): diff -r 70123c669c9e -r 93b87a416b72 pywin32_postinstall.py --- a/pywin32_postinstall.py Thu May 10 09:09:42 2012 -0400 +++ b/pywin32_postinstall.py Sat May 12 13:46:28 2012 +1000 @@ -156,8 +156,7 @@ filename = "%s%d%d%s.dll" % \ (modname, sys.version_info[0], sys.version_info[1], suffix) filename = os.path.join(lib_dir, "pywin32_system32", filename) - mod = imp.load_module(modname, None, filename, - ('.dll', 'rb', imp.C_EXTENSION)) + mod = imp.load_dynamic(modname, filename) def SetPyKeyVal(key_name, value_name, value): diff -r 70123c669c9e -r 93b87a416b72 setup.py --- a/setup.py Thu May 10 09:09:42 2012 -0400 +++ b/setup.py Sat May 12 13:46:28 2012 +1000 @@ -2196,7 +2196,7 @@ def expand_modules(module_dir): flist = FileList() flist.findall(module_dir) - flist.include_pattern("*.py") + flist.include_pattern("*.py", anchor=0) return [os.path.splitext(name)[0] for name in flist.files] # NOTE: somewhat counter-intuitively, a result list a-la: |
|
From: <pyw...@li...> - 2012-05-10 13:12:47
|
changeset f3b7d2b5ea18 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=f3b7d2b5ea18 summary: Added test capturing failure indicated by #3524786. changeset dbb2d86a9bbc in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=dbb2d86a9bbc summary: Potential fix for 3524786 changeset ba623bb65a7b in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=ba623bb65a7b summary: win32timezone now recognizes when attempts to discern dst are ambiguous and raises win32timezone.AmbiguousTimeError in that case. This change required overriding fromutc because the default implementation depends on the dst-shifted times and cannot use the standard bias directly. changeset 70123c669c9e in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=70123c669c9e summary: collapse tag fix diffstat: .hgtags | 94 +++++++++++++++++++++++----------------------- win32/Lib/win32timezone.py | 65 +++++++++++++++++++++++++++++- 2 files changed, 108 insertions(+), 51 deletions(-) diffs (215 lines): diff -r 085048997feb -r 70123c669c9e .hgtags --- a/.hgtags Fri May 04 20:11:44 2012 -0400 +++ b/.hgtags Thu May 10 09:09:42 2012 -0400 @@ -1,48 +1,48 @@ -41f1bd66b7021c117875e6b682c497ed6fc2cc10 b206 -3f840c6cf56d1cebf71f6431a4e0efbdfdbad67f b207 -f661faf30bc176e8c7da0f270cacc6efeec6f93b b200 -3cc78fc452fc36735ad7657d55ada4a8c707ce98 b201 -e9680446f9501cea73d8c7cbb4f605ac4735f9f7 b134 -21b963e6aef75c4200cffad4e1d82f00ea7f4004 b135 -5772e8f5879d4e99bd8f011ebd6e22ac77b62326 b132 -cfc3d45d90b99ba94f2a4f0959bc87929c6bd467 b205 -509f3e5d7cf8a3538107fd16f0082c2cbfc6969b b130 -1c7f25ac9159234948ab5b6dc90bbb4a40cdb004 b131 -18e90fae54ee83cd4e843eea420363238310bad7 b208 -66090658b3de364fc0c82f8ba50c8e53c6656c31 b209 -fc11455ae6b156ef2f5de8c9278249ca331f62d0 py3k-merge-complete -be3f97064797e0ca0cd74e9eaa87165e10f7cad1 ActivePython210 -dc1672d20522850fae56111e22ccb5685f42f595 ActivePython211 -4273326c4e0d7bf084a6f9b2053d932e22a931be b157 -c29a3a48e23333cf69bf06e38709fb95dc1c4e0b b151 -84e9214951e2e643b4cc69f3aeb65096a9084333 b153 -627797aca18f5da4f850d1ce7a3b92551a00d9dc b159 -4381189ca772314be36c8f3ab6405df2b0e3054c b214 -6c8737a7ad24df7221bb5185454b9eea9ace1e43 b139 -78f2b0c832f605e114e054428b0c7cbb5b604b3f adodbapi_2_1 -0059bca6a08fd0f53ed15c53dd9c7cdf4f30277a b213 -e2bf22f83e33af157d585b97c84396a9e29517e2 b212 -2d64b7bd69085ff1a205082a342ceaa901b315db b211 -0368e8bf35fe715afdc8cd4e0f14207395d57b0f a2 -a9c6f2e0d1c9abe01912609898571aa392b872c7 b216 -3ed66b823bbf0deb92a34c86dd1dd6814bb48c5e b127 -389edbdcad88a68b57d3d4a75bc86c8804cf49c0 b126 -cc382129d3bedf1392fbb44b9ded529ff6b4de0e b129 -b64d19fa71db1cbc33c29d6ba5b4941beae80c8e b128 -9f6fdae45eb75468d6c09c77782219879c4c50bf b215 -06b7c2aead8d38bb7364b4efbdff51e5afb7f839 b147 -bdd4dbfaa9bc4b4758a912daeb8d30c3ec12d081 b146 -9dbc9b744bd27066f74d9c09da70866d99fe71f7 b145 -81514808c099a0060e5318b7e5dc1c53c6ebb3ab ActivePython202 -7900668f7ffb11e819e1a3ae8755f86c89552fcd b142 -917d31f81f0044a01c2c3516e2cf080a33206f97 b141 -1a192704d03f2c0b9cd0fb7fa59b6df51b696973 b140 -59e2f06b53e4d3ea81109e76bd686677d34d21f4 adodbapi_2_2_2 -972b58e9f118695958deebe404726e4f957f0e8b b202 -54c1f0e5035e1bd2cd38761b830778f91fd0f1d0 b149 -f21d815cbde468897d74c4f9c4de09ab8306c405 b148 -a8e244f6bb667d07c1d4b4ad1e163f3a99f7eaae b203 -b634f1c59fb9b502d2c1ee9e692e4067d7940901 b129f -c3eb7ad6c64194e120ad9037fa6299b7c6a6ef1e b204 -6ccccc93a646531a4fb0d904b83e18d324c59d01 cvs2hg +41f1bd66b7021c117875e6b682c497ed6fc2cc10 b206 +3f840c6cf56d1cebf71f6431a4e0efbdfdbad67f b207 +f661faf30bc176e8c7da0f270cacc6efeec6f93b b200 +3cc78fc452fc36735ad7657d55ada4a8c707ce98 b201 +e9680446f9501cea73d8c7cbb4f605ac4735f9f7 b134 +21b963e6aef75c4200cffad4e1d82f00ea7f4004 b135 +5772e8f5879d4e99bd8f011ebd6e22ac77b62326 b132 +cfc3d45d90b99ba94f2a4f0959bc87929c6bd467 b205 +509f3e5d7cf8a3538107fd16f0082c2cbfc6969b b130 +1c7f25ac9159234948ab5b6dc90bbb4a40cdb004 b131 +18e90fae54ee83cd4e843eea420363238310bad7 b208 +66090658b3de364fc0c82f8ba50c8e53c6656c31 b209 +fc11455ae6b156ef2f5de8c9278249ca331f62d0 py3k-merge-complete +be3f97064797e0ca0cd74e9eaa87165e10f7cad1 ActivePython210 +dc1672d20522850fae56111e22ccb5685f42f595 ActivePython211 +4273326c4e0d7bf084a6f9b2053d932e22a931be b157 +c29a3a48e23333cf69bf06e38709fb95dc1c4e0b b151 +84e9214951e2e643b4cc69f3aeb65096a9084333 b153 +627797aca18f5da4f850d1ce7a3b92551a00d9dc b159 +4381189ca772314be36c8f3ab6405df2b0e3054c b214 +6c8737a7ad24df7221bb5185454b9eea9ace1e43 b139 +78f2b0c832f605e114e054428b0c7cbb5b604b3f adodbapi_2_1 +0059bca6a08fd0f53ed15c53dd9c7cdf4f30277a b213 +e2bf22f83e33af157d585b97c84396a9e29517e2 b212 +2d64b7bd69085ff1a205082a342ceaa901b315db b211 +0368e8bf35fe715afdc8cd4e0f14207395d57b0f a2 +a9c6f2e0d1c9abe01912609898571aa392b872c7 b216 +3ed66b823bbf0deb92a34c86dd1dd6814bb48c5e b127 +389edbdcad88a68b57d3d4a75bc86c8804cf49c0 b126 +cc382129d3bedf1392fbb44b9ded529ff6b4de0e b129 +b64d19fa71db1cbc33c29d6ba5b4941beae80c8e b128 +9f6fdae45eb75468d6c09c77782219879c4c50bf b215 +06b7c2aead8d38bb7364b4efbdff51e5afb7f839 b147 +bdd4dbfaa9bc4b4758a912daeb8d30c3ec12d081 b146 +9dbc9b744bd27066f74d9c09da70866d99fe71f7 b145 +81514808c099a0060e5318b7e5dc1c53c6ebb3ab ActivePython202 +7900668f7ffb11e819e1a3ae8755f86c89552fcd b142 +917d31f81f0044a01c2c3516e2cf080a33206f97 b141 +1a192704d03f2c0b9cd0fb7fa59b6df51b696973 b140 +59e2f06b53e4d3ea81109e76bd686677d34d21f4 adodbapi_2_2_2 +972b58e9f118695958deebe404726e4f957f0e8b b202 +54c1f0e5035e1bd2cd38761b830778f91fd0f1d0 b149 +f21d815cbde468897d74c4f9c4de09ab8306c405 b148 +a8e244f6bb667d07c1d4b4ad1e163f3a99f7eaae b203 +b634f1c59fb9b502d2c1ee9e692e4067d7940901 b129f +c3eb7ad6c64194e120ad9037fa6299b7c6a6ef1e b204 +6ccccc93a646531a4fb0d904b83e18d324c59d01 cvs2hg 5c3a57938569a9a0321b59037bddf99721f61f95 b217 diff -r 085048997feb -r 70123c669c9e win32/Lib/win32timezone.py --- a/win32/Lib/win32timezone.py Fri May 04 20:11:44 2012 -0400 +++ b/win32/Lib/win32timezone.py Thu May 10 09:09:42 2012 -0400 @@ -202,6 +202,8 @@ datetime.datetime(2011, 11, 5, 19, 0, tzinfo=TimeZoneInfo('Pacific Standard Time')) Make sure the converted time is correct. +>>> tz_pac +TimeZoneInfo('Pacific Standard Time') >>> dt_pac = dt_hi.astimezone(tz_pac) >>> dt_pac.timetuple() time.struct_time(tm_year=2011, tm_mon=11, tm_mday=5, tm_hour=19, tm_min=0, tm_sec=0, tm_wday=5, tm_yday=309, tm_isdst=1) @@ -223,7 +225,32 @@ True >>> (offset + dst_offset) == datetime.timedelta(hours=-7) True + +Test offsets that occur right at the DST changeover +>>> datetime.datetime.utcfromtimestamp(1320570000).replace( +... tzinfo=TimeZoneInfo.utc()).astimezone(tz_pac) +datetime.datetime(2011, 11, 6, 1, 0, tzinfo=TimeZoneInfo('Pacific Standard Time')) + +TimeZoneInfo now raises AmbiguousTimeError for ambiguous times +============================================================== + +Is 1:15 the first one, or the one after clocks were set back? +>>> ambiguous = datetime.datetime(2011, 11, 6, 1, 15) +>>> est = TimeZoneInfo('Eastern Standard Time') +>>> est.dst(ambiguous) +Traceback (most recent call last): +[...] +AmbiguousTimeError: 2011-11-06 01:15:00 +>>> est.utcoffset(ambiguous) +Traceback (most recent call last): +[...] +AmbiguousTimeError: 2011-11-06 01:15:00 + +However, if we're converting from UTC, it's not ambiguous. +>>> datetime.datetime(2011, 11, 6, 6, 0, tzinfo=TimeZoneInfo.utc()).astimezone(est) +datetime.datetime(2011, 11, 6, 1, 0, tzinfo=TimeZoneInfo('Eastern Standard Time')) """ + from __future__ import generators __author__ = 'Jason R. Coombs <ja...@ja...>' @@ -588,6 +615,19 @@ winInfo = self.getWinInfo(dt.year) return winInfo.bias + winInfo.daylight_bias + def fromutc(self, dt): + if dt.tzinfo is not self: + raise ValueError("tzinfo is not self") + # calculate the local time using the standard offset + tz_std = TimeZoneInfo(self.timeZoneName, fix_standard_time=True) + delta = tz_std.utcoffset(dt) + dt += delta + try: + dt += self.dst(dt) + except AmbiguousTimeError: + pass + return dt + def utcoffset(self, dt): "Calculates the utcoffset according to the datetime.tzinfo spec" if dt is None: return @@ -605,22 +645,36 @@ return -result def _inDaylightSavings(self, dt): + dt = dt.replace(tzinfo=None) + winInfo = self.getWinInfo(dt.year) try: dstStart = self.GetDSTStartTime(dt.year) dstEnd = self.GetDSTEndTime(dt.year) + # at the end of DST, when clocks are moved back, there's a period + # of daylight_bias where it's ambiguous whether we're in DST or + # not. + dstEndAdj = dstEnd + winInfo.daylight_bias + + # the same thing could theoretically happen at the start of DST + # if there's a standard_bias (which I suspect is always 0). + dstStartAdj = dstStart + winInfo.standard_bias + + if dstEndAdj <= dt < dstEnd or dstStartAdj <= dt < dstStart: + raise AmbiguousTimeError(dt) + if dstStart < dstEnd: - inDaylightSavings = dstStart <= dt.replace(tzinfo=None) < dstEnd + in_dst = dstStartAdj <= dt < dstEndAdj else: # in the southern hemisphere, daylight savings time # typically ends before it begins in a given year. - inDaylightSavings = not (dstEnd < dt.replace(tzinfo=None) <= dstStart) + in_dst = not (dstEndAdj < dt <= dstStartAdj) except ValueError: # there was an error parsing the time zone, which is normal when a # start and end time are not specified. - inDaylightSavings = False + in_dst = False - return inDaylightSavings + return in_dst def GetDSTStartTime(self, year): "Given a year, determines the time when daylight savings time starts" @@ -787,6 +841,9 @@ GetSortedTimeZoneNames = deprecated(TimeZoneInfo.get_sorted_time_zone_names, 'GetSortedTimeZoneNames') # end backward compatibility +class AmbiguousTimeError(Exception): + pass + def utcnow(): """ Return the UTC time now with timezone awareness as enabled |
|
From: <pyw...@li...> - 2012-05-05 00:12:02
|
changeset 085048997feb in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=085048997feb summary: Corrected error in the sign on TimeZoneInfo.dst(). The incorrect sign was on the .dst() value, but the mistake was masked because utcoffset again negated the value. Thanks to Brian Matthews for discovering the bug, providing a detailed bug report to reproduce the error, and for suggesting fixes in #3523104. diffstat: win32/Lib/win32timezone.py | 84 +++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 79 insertions(+), 5 deletions(-) diffs (115 lines): diff -r bb81eda78987 -r 085048997feb win32/Lib/win32timezone.py --- a/win32/Lib/win32timezone.py Mon Apr 30 17:50:11 2012 +1000 +++ b/win32/Lib/win32timezone.py Fri May 04 20:11:44 2012 -0400 @@ -6,9 +6,6 @@ registry for time zone information. The time zone names are dependent on the registry entries defined by the operating system. - Currently, this module only supports the Windows NT line of products -and not Windows 95/98/Me. - This module may be tested using the doctest module. Written by Jason R. Coombs (ja...@ja...). @@ -149,6 +146,83 @@ This test helps ensure language support for unicode characters >>> x = TIME_ZONE_INFORMATION(0, u'français') + +Test conversion from one time zone to another at a DST boundary +=============================================================== + +>>> tz_hi = TimeZoneInfo('Hawaiian Standard Time') +>>> tz_pac = TimeZoneInfo('Pacific Standard Time') +>>> time_before = datetime.datetime(2011, 11, 5, 15, 59, 59, tzinfo=tz_hi) +>>> tz_hi.utcoffset(time_before) +datetime.timedelta(-1, 50400) +>>> tz_hi.dst(time_before) +datetime.timedelta(0) + +Hawaii doesn't need dynamic TZ info +>>> getattr(tz_hi, 'dynamicInfo', None) + +Here's a time that gave some trouble as reported in #3523104 +because one minute later, the equivalent UTC time changes from DST +in the U.S. +>>> dt_hi = datetime.datetime(2011, 11, 5, 15, 59, 59, 0, tzinfo=tz_hi) +>>> dt_hi.timetuple() +time.struct_time(tm_year=2011, tm_mon=11, tm_mday=5, tm_hour=15, tm_min=59, tm_sec=59, tm_wday=5, tm_yday=309, tm_isdst=0) +>>> dt_hi.utctimetuple() +time.struct_time(tm_year=2011, tm_mon=11, tm_mday=6, tm_hour=1, tm_min=59, tm_sec=59, tm_wday=6, tm_yday=310, tm_isdst=0) + +Convert the time to pacific time. +>>> dt_pac = dt_hi.astimezone(tz_pac) +>>> dt_pac.timetuple() +time.struct_time(tm_year=2011, tm_mon=11, tm_mday=5, tm_hour=18, tm_min=59, tm_sec=59, tm_wday=5, tm_yday=309, tm_isdst=1) + +Notice that the UTC time is almost 2am. +>>> dt_pac.utctimetuple() +time.struct_time(tm_year=2011, tm_mon=11, tm_mday=6, tm_hour=1, tm_min=59, tm_sec=59, tm_wday=6, tm_yday=310, tm_isdst=0) + +Now do the same tests one minute later in Hawaii. +>>> time_after = datetime.datetime(2011, 11, 5, 16, 0, 0, 0, tzinfo=tz_hi) +>>> tz_hi.utcoffset(time_after) +datetime.timedelta(-1, 50400) +>>> tz_hi.dst(time_before) +datetime.timedelta(0) + +>>> dt_hi = datetime.datetime(2011, 11, 5, 16, 0, 0, 0, tzinfo=tz_hi) +>>> print dt_hi.timetuple() +time.struct_time(tm_year=2011, tm_mon=11, tm_mday=5, tm_hour=16, tm_min=0, tm_sec=0, tm_wday=5, tm_yday=309, tm_isdst=0) +>>> print dt_hi.utctimetuple() +time.struct_time(tm_year=2011, tm_mon=11, tm_mday=6, tm_hour=2, tm_min=0, tm_sec=0, tm_wday=6, tm_yday=310, tm_isdst=0) + +According to the docs, this is what astimezone does. +>>> utc = (dt_hi - dt_hi.utcoffset()).replace(tzinfo=tz_pac) +>>> utc +datetime.datetime(2011, 11, 6, 2, 0, tzinfo=TimeZoneInfo('Pacific Standard Time')) +>>> tz_pac.fromutc(utc) == dt_hi.astimezone(tz_pac) +True +>>> tz_pac.fromutc(utc) +datetime.datetime(2011, 11, 5, 19, 0, tzinfo=TimeZoneInfo('Pacific Standard Time')) + +Make sure the converted time is correct. +>>> dt_pac = dt_hi.astimezone(tz_pac) +>>> dt_pac.timetuple() +time.struct_time(tm_year=2011, tm_mon=11, tm_mday=5, tm_hour=19, tm_min=0, tm_sec=0, tm_wday=5, tm_yday=309, tm_isdst=1) +>>> dt_pac.utctimetuple() +time.struct_time(tm_year=2011, tm_mon=11, tm_mday=6, tm_hour=2, tm_min=0, tm_sec=0, tm_wday=6, tm_yday=310, tm_isdst=0) + +Check some internal methods +>>> tz_pac._getStandardBias(datetime.datetime(2011, 1, 1)) +datetime.timedelta(0, 28800) +>>> tz_pac._getDaylightBias(datetime.datetime(2011, 1, 1)) +datetime.timedelta(0, 25200) + +Test the offsets +>>> offset = tz_pac.utcoffset(datetime.datetime(2011, 11, 6, 2, 0)) +>>> offset == datetime.timedelta(hours=-8) +True +>>> dst_offset = tz_pac.dst(datetime.datetime(2011, 11, 6, 2, 0) + offset) +>>> dst_offset == datetime.timedelta(hours=1) +True +>>> (offset + dst_offset) == datetime.timedelta(hours=-7) +True """ from __future__ import generators @@ -518,7 +592,7 @@ "Calculates the utcoffset according to the datetime.tzinfo spec" if dt is None: return winInfo = self.getWinInfo(dt.year) - return -(winInfo.bias + self.dst(dt)) + return -winInfo.bias + self.dst(dt) def dst(self, dt): "Calculates the daylight savings offset according to the datetime.tzinfo spec" @@ -528,7 +602,7 @@ result = winInfo.daylight_bias else: result = winInfo.standard_bias - return result + return -result def _inDaylightSavings(self, dt): try: |
|
From: <pyw...@li...> - 2012-04-30 07:51:08
|
changeset bb81eda78987 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=bb81eda78987 summary: work around FileList() bugfix in Python 2.7+, thanks to clues from Tim Golden diffstat: setup.py | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diffs (24 lines): diff -r 7319d151e057 -r bb81eda78987 setup.py --- a/setup.py Wed Apr 25 21:23:31 2012 -0400 +++ b/setup.py Mon Apr 30 17:50:11 2012 +1000 @@ -2211,15 +2211,15 @@ if file.find("*") >= 0: flist = FileList() flist.findall(os.path.dirname(file)) - flist.include_pattern(os.path.basename(file)) + flist.include_pattern(os.path.basename(file), anchor=0) # We never want CVS - flist.exclude_pattern(re.compile(".*\\\\CVS\\\\"), is_regex=1) - flist.exclude_pattern("*.pyc") - flist.exclude_pattern("*.pyo") + flist.exclude_pattern(re.compile(".*\\\\CVS\\\\"), is_regex=1, anchor=0) + flist.exclude_pattern("*.pyc", anchor=0) + flist.exclude_pattern("*.pyo", anchor=0) # files with a leading dot upset bdist_msi, and '.*' doesn't # work - it matches from the start of the string and we have # dir names. So any '\.' gets the boot. - flist.exclude_pattern(re.compile(".*\\\\\."), is_regex=1) + flist.exclude_pattern(re.compile(".*\\\\\."), is_regex=1, anchor=0) if not flist.files: raise RuntimeError("No files match '%s'" % file) files_use = flist.files |
|
From: <pyw...@li...> - 2012-04-26 01:23:44
|
changeset 7319d151e057 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=7319d151e057 summary: Updated copyright diffstat: win32/Lib/win32timezone.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r aa3a7ed32634 -r 7319d151e057 win32/Lib/win32timezone.py --- a/win32/Lib/win32timezone.py Wed Apr 25 21:20:23 2012 -0400 +++ b/win32/Lib/win32timezone.py Wed Apr 25 21:23:31 2012 -0400 @@ -12,7 +12,7 @@ This module may be tested using the doctest module. Written by Jason R. Coombs (ja...@ja...). - Copyright © 2003-2009. + Copyright © 2003-2012. All Rights Reserved. This module is licenced for use in Mark Hammond's pywin32 |
|
From: <pyw...@li...> - 2012-04-26 01:22:37
|
changeset f236bfbddd8e in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=f236bfbddd8e summary: Cleaned up some unused imports, indentation issues, and encoding issues. Tests now passing again on Python 2.7.3 changeset 4a170a732caf in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=4a170a732caf summary: Added a test to capture failing dynamic info resolution as reported in #3521185. changeset 0d04c356ccdc in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=0d04c356ccdc summary: Identified another test that indicates the failure changeset aa3a7ed32634 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=aa3a7ed32634 summary: Updated RangeMap implementation with version from jaraco.util 5.3.1 that includes a fix for RangeMap.get. This fixes the failing tests, including the issue identified by 3521185. diffstat: win32/Lib/win32timezone.py | 185 ++++++++++++++++++++++++++++++-------------- 1 files changed, 124 insertions(+), 61 deletions(-) diffs (truncated from 322 to 300 lines): diff -r da4e0fd94239 -r aa3a7ed32634 win32/Lib/win32timezone.py --- a/win32/Lib/win32timezone.py Sun Apr 22 14:09:05 2012 -0400 +++ b/win32/Lib/win32timezone.py Wed Apr 25 21:20:23 2012 -0400 @@ -147,23 +147,18 @@ True This test helps ensure language support for unicode characters ->>> x = TIME_ZONE_INFORMATION(0, 'français') +>>> x = TIME_ZONE_INFORMATION(0, u'français') """ from __future__ import generators __author__ = 'Jason R. Coombs <ja...@ja...>' -__version__ = '$Revision$'[11:-2] -__sccauthor__ = '$Author$'[9:-2] -__date__ = '$Date$'[10:-2] -import os import _winreg import struct import datetime import win32api import re -import sys import operator import warnings from itertools import count @@ -196,7 +191,7 @@ setattr(self, name, def_val) def field_names(self): - return [f[0] for f in fields] + return [f[0] for f in self._fields_] def __eq__(self, other): if not hasattr(other, "_fields_"): @@ -373,8 +368,19 @@ TimeZoneInfo(<Time Zone Standard Name>, [<Fix Standard Time>]) If <Fix Standard Time> evaluates to True, daylight savings time is - calculated in the same - way as standard time. + calculated in the same way as standard time. + + >>> tzi = TimeZoneInfo('Pacific Standard Time') + >>> march31 = datetime.datetime(2000,3,31) + + We know that time zone definitions haven't changed from 2007 + to 2012, so regardless of whether dynamic info is available, + there should be consistent results for these years. + >>> subsequent_years = [march31.replace(year=year) + ... for year in range(2007, 2013)] + >>> offsets = set(tzi.utcoffset(year) for year in subsequent_years) + >>> len(offsets) + 1 """ # this key works for WinNT+, but not for the Win95 line. @@ -421,6 +427,40 @@ self.staticInfo = tzi def _LoadDynamicInfoFromKey(self, key): + """ + >>> tzi = TimeZoneInfo('Central Standard Time') + + Here's how the RangeMap is supposed to work: + >>> m = RangeMap(zip([2006,2007], 'BC'), + ... sort_params = dict(reverse=True), + ... key_match_comparator=operator.ge) + >>> m.get(2000, 'A') + 'A' + >>> m[2006] + 'B' + >>> m[2007] + 'C' + >>> m[2008] + 'C' + + >>> m[RangeMap.last_item] + 'B' + + >>> m.get(2008, m[RangeMap.last_item]) + 'C' + + + Now test the dynamic info (but fallback to our simple RangeMap + on systems that don't have dynamicInfo). + + >>> dinfo = getattr(tzi, 'dynamicInfo', m) + >>> 2007 in dinfo + True + >>> 2008 in dinfo + False + >>> dinfo[2007] == dinfo[2008] == dinfo[2012] + True + """ try: info = key.subkey('Dynamic DST') except WindowsError: @@ -431,7 +471,9 @@ values = map(TimeZoneDefinition, info.values()) # create a range mapping that searches by descending year and matches # if the target year is greater or equal. - self.dynamicInfo = RangeMap(zip(years, values), descending, operator.ge) + self.dynamicInfo = RangeMap(zip(years, values), + sort_params = dict(reverse=True), + key_match_comparator = operator.ge) def __repr__(self): result = '%s(%s' % (self.__class__.__name__, repr(self.timeZoneName)) @@ -452,12 +494,17 @@ return result def getWinInfo(self, targetYear): + """ + Return the most relevant "info" for this time zone + in the target year. + """ if not hasattr(self, 'dynamicInfo') or not self.dynamicInfo: return self.staticInfo # Find the greatest year entry in self.dynamicInfo which is for # a year greater than or equal to our targetYear. If not found, # default to the earliest year. - return self.dynamicInfo.get(targetYear, self.dynamicInfo[RangeItemLast()]) + return self.dynamicInfo.get(targetYear, + self.dynamicInfo[RangeMap.last_item]) def _getStandardBias(self, dt): winInfo = self.getWinInfo(dt.year) @@ -527,7 +574,7 @@ >>> now_UTC = datetime.datetime.utcnow() >>> (now_UTC - now_local) < datetime.timedelta(seconds = 5) Traceback (most recent call last): - ... + ... TypeError: can't subtract offset-naive and offset-aware datetimes >>> now_UTC = now_UTC.replace(tzinfo = TimeZoneInfo('GMT Standard Time', True)) @@ -601,7 +648,7 @@ """ Return the time zones sorted by some key. key must be a function that takes a TimeZoneInfo object and returns - a value suitable for sorting on. + a value suitable for sorting on. The key defaults to the bias (descending), as is done in Windows (see http://blogs.msdn.com/michkap/archive/2006/12/22/1350684.aspx) """ @@ -654,7 +701,7 @@ when the function is used.""" def newFunc(*args, **kwargs): warnings.warn("Call to deprecated function %s." % name, - category=DeprecationWarning) + category=DeprecationWarning) return func(*args, **kwargs) newFunc.__name__ = func.__name__ newFunc.__doc__ = func.__doc__ @@ -712,6 +759,7 @@ >>> try: unicode and None ... except NameError: unicode=str ... + >>> import sys >>> result = resolveMUITimeZone('@tzres.dll,-110') >>> expectedResultType = [type(None),unicode][sys.getwindowsversion() >= (6,)] >>> type(result) is expectedResultType @@ -727,94 +775,109 @@ try: handle = DLLCache[matcher.groupdict()['dllname']] result = win32api.LoadString(handle, int(matcher.groupdict()['index'])) - except win32api.error, e: + except win32api.error: result = None return result -# the following code implements a RangeMap and its support classes +# from jaraco.util.dictlib 5.3.1 +class RangeMap(dict): + """ + A dictionary-like object that uses the keys as bounds for a range. + Inclusion of the value for that range is determined by the + key_match_comparator, which defaults to less-than-or-equal. + A value is returned for a key if it is the first key that matches in + the sorted list of keys. -ascending = lambda a, b: b < a -def descending(a, b): - return not ascending(a, b) - -class RangeMap(dict): - """A dictionary-like object that uses the keys as bounds for a range. - Inclusion of the value for that range is determined by the - keyMatchComparator, which defaults to greater-than-or-equal. - A value is returned for a key if it is the first key that matches in - the sorted list of keys. By default, keys are sorted in ascending - order, but can be sorted in any other order using the keySortComparator. + One may supply keyword parameters to be passed to the sort function used + to sort keys (i.e. cmp [python 2 only], keys, reverse) as sort_params. Let's create a map that maps 1-3 -> 'a', 4-6 -> 'b' >>> r = RangeMap({3: 'a', 6: 'b'}) # boy, that was easy >>> r[1], r[2], r[3], r[4], r[5], r[6] ('a', 'a', 'a', 'b', 'b', 'b') + Even float values should work so long as the comparison operator + supports it. + >>> r[4.5] + 'b' + But you'll notice that the way rangemap is defined, it must be open-ended on one side. >>> r[0] 'a' >>> r[-1] 'a' - One can close the open-end of the RangeMap by using RangeValueUndefined - >>> r = RangeMap({0: RangeValueUndefined(), 3: 'a', 6: 'b'}) + One can close the open-end of the RangeMap by using undefined_value + >>> r = RangeMap({0: RangeMap.undefined_value, 3: 'a', 6: 'b'}) >>> r[0] Traceback (most recent call last): - ... + ... KeyError: 0 - One can get the first or last elements in the range by using RangeItem - >>> last_item = RangeItem(-1) + One can get the first or last elements in the range by using RangeMap.Item + >>> last_item = RangeMap.Item(-1) >>> r[last_item] 'b' - >>> r[RangeItemLast()] + .last_item is a shortcut for Item(-1) + >>> r[RangeMap.last_item] 'b' + Sometimes it's useful to find the bounds for a RangeMap >>> r.bounds() (0, 6) + RangeMap supports .get(key, default) + >>> r.get(0, 'not found') + 'not found' + + >>> r.get(7, 'not found') + 'not found' + """ - def __init__(self, source, keySortComparator = ascending, keyMatchComparator = operator.le): + def __init__(self, source, sort_params = {}, key_match_comparator = operator.le): dict.__init__(self, source) - self.sort = keySortComparator - self.match = keyMatchComparator - - def _get_sorted_keys(self): - sortedKeys = self.keys() - reverse = self.match != operator.le - sortedKeys.sort(reverse=reverse) - return sortedKeys + self.sort_params = sort_params + self.match = key_match_comparator def __getitem__(self, item): - sortedKeys = self._get_sorted_keys() - if isinstance(item, RangeItem): - result = self.__getitem__(sortedKeys[item]) + sorted_keys = sorted(self.keys(), **self.sort_params) + if isinstance(item, RangeMap.Item): + result = self.__getitem__(sorted_keys[item]) else: - key = self._find_first_match_(sortedKeys, item) + key = self._find_first_match_(sorted_keys, item) result = dict.__getitem__(self, key) - if isinstance(result, RangeValueUndefined): raise KeyError(key) + if result is RangeMap.undefined_value: + raise KeyError(key) return result + def get(self, key, default=None): + """ + Return the value for key if key is in the dictionary, else default. + If default is not given, it defaults to None, so that this method + never raises a KeyError. + """ + try: + return self[key] + except KeyError: + return default + def _find_first_match_(self, keys, item): is_match = lambda k: self.match(item, k) - # use of ifilter here would be more efficent - matches = [k for k in keys if is_match(k)] + matches = list(filter(is_match, keys)) if matches: return matches[0] raise KeyError(item) def bounds(self): - sortedKeys = self._get_sorted_keys() |
|
From: <pyw...@li...> - 2012-04-24 05:47:57
|
changeset da4e0fd94239 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=da4e0fd94239 summary: Include the method name when reporting that a callback returned a bad value diffstat: Pythonwin/win32uimodule.cpp | 59 +++++++++++++++++++++++++++++++++++++++----- 1 files changed, 52 insertions(+), 7 deletions(-) diffs (76 lines): diff -r f8467b5a5da3 -r da4e0fd94239 Pythonwin/win32uimodule.cpp --- a/Pythonwin/win32uimodule.cpp Sun Apr 22 01:12:49 2012 -0400 +++ b/Pythonwin/win32uimodule.cpp Sun Apr 22 14:09:05 2012 -0400 @@ -735,20 +735,65 @@ return result; } +// Copied from PyRecord.cpp, should move into pywintypes.h +#if (PY_VERSION_HEX < 0x03000000) +#define PyWinCoreString_ConcatAndDel PyString_ConcatAndDel +#define PyWinCoreString_Concat PyString_Concat +#else +// Unicode versions of '_Concat' etc have different sigs. Make them the +// same here... +void PyWinCoreString_Concat(register PyObject **pv, register PyObject *w) +{ + if (!w) { // hrm - string version doesn't do this, but I saw PyObject_Repr() return NULL... + Py_XDECREF(*pv); + *pv = NULL; + return; + } + PyObject *tmp = PyUnicode_Concat(*pv, w); + Py_DECREF(*pv); + *pv = tmp; +} + +void PyWinCoreString_ConcatAndDel(register PyObject **pv, register PyObject *w) +{ + PyWinCoreString_Concat(pv, w); + Py_XDECREF(w); +} + +#endif + int Python_do_int_callback(PyObject *themeth, PyObject *thearglst) { - int retVal=UINT_MAX; // an identifiable, but unlikely genuine value. - BOOL isError = FALSE; + int retVal=INT_MAX; // an identifiable, but unlikely genuine value + // Was formerly UINT_MAX, which is actually -1 when placed in a signed int PyObject *result = Python_do_callback(themeth, thearglst); if (result==NULL) return retVal; if (result==Py_None) // allow for None==0 retVal = 0; - else if (result != Py_None && (!PyArg_Parse(result,"i",&retVal))) { - TRACE("Python_do_int_callback: callback had bad return type\n"); - PyErr_SetString(ui_module_error, "Callback must return an integer, or None"); - gui_print_error(); - } + else{ + retVal = PyInt_AsLong(result); + if (retVal == -1 && PyErr_Occurred()){ + gui_print_error(); + TRACE("Python_do_int_callback: callback had bad return type\n"); + // Include the method in the error msg so the bad callback can actually be found + PyObject *meth_name=NULL, *err_static=NULL; + meth_name = PyObject_Repr(themeth); + if (meth_name == NULL) + gui_print_error(); // not much else we can do + err_static = PyWinCoreString_FromString(" - Callback must return an integer, or None"); + if (err_static == NULL) + gui_print_error(); + if (meth_name && err_static){ + PyWinCoreString_Concat(&meth_name, err_static); + if (meth_name) + PyErr_SetObject(ui_module_error, meth_name); + gui_print_error(); + } + Py_XDECREF(meth_name); + Py_XDECREF(err_static); + } + } #ifdef _DEBUG_HEAP // perform some diagnostics. May help trap reference errors. if (_heapchk()!=_HEAPOK) TRACE("**** Warning-heap corrupt after application callback ****\n"); |
|
From: <pyw...@li...> - 2012-04-22 05:16:26
|
changeset f8467b5a5da3 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=f8467b5a5da3 summary: Add encoding attribute to pywin.framework.interact.InteractiveView diffstat: Pythonwin/pywin/framework/interact.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diffs (12 lines): diff -r a72460d9b458 -r f8467b5a5da3 Pythonwin/pywin/framework/interact.py --- a/Pythonwin/pywin/framework/interact.py Fri Apr 20 04:38:54 2012 -0400 +++ b/Pythonwin/pywin/framework/interact.py Sun Apr 22 01:12:49 2012 -0400 @@ -631,6 +631,8 @@ def __init__(self, doc): InteractiveCore.__init__(self) winout.WindowOutputView.__init__(self, doc) + self.encoding = pywin.default_scintilla_encoding + def _MakeColorizer(self): return InteractiveFormatter(self) def OnInitialUpdate(self): |
|
From: <pyw...@li...> - 2012-04-20 08:40:13
|
changeset a72460d9b458 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=a72460d9b458 summary: Fix error return in win32gui.GetClassName diffstat: win32/src/win32gui.i | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r 6e918dcbc8c7 -r a72460d9b458 win32/src/win32gui.i --- a/win32/src/win32gui.i Wed Apr 11 12:25:05 2012 -0400 +++ b/win32/src/win32gui.i Fri Apr 20 04:38:54 2012 -0400 @@ -5996,7 +5996,7 @@ // dont bother with lock - no callback possible. int nchars = GetClassName(hwnd, buf, sizeof buf/sizeof buf[0]); if (nchars==0) - PyWin_SetAPIError("GetClassName"); + return PyWin_SetAPIError("GetClassName"); return PyWinObject_FromTCHAR(buf, nchars); } %} |
|
From: <pyw...@li...> - 2012-04-11 16:36:02
|
changeset 6e918dcbc8c7 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=6e918dcbc8c7 summary: Fix a crash when returning a Record field that holds an array; Remove a lot of cruft diffstat: com/win32com/src/PyRecord.cpp | 105 ++++++++--------------------------------- 1 files changed, 22 insertions(+), 83 deletions(-) diffs (236 lines): diff -r 7b09e7868706 -r 6e918dcbc8c7 com/win32com/src/PyRecord.cpp --- a/com/win32com/src/PyRecord.cpp Sat Apr 07 17:26:31 2012 -0400 +++ b/com/win32com/src/PyRecord.cpp Wed Apr 11 12:25:05 2012 -0400 @@ -4,66 +4,7 @@ // @doc -// A refugee from pywintypes and should die -PyObject *PyString_FromUnicode( const OLECHAR *str ) -{ - if (str==NULL) { - Py_INCREF(Py_None); - return Py_None; - } - PyObject *uo = PyWinObject_FromOLECHAR(str); - if (uo==NULL) return NULL; - PyObject *ret = PyUnicode_EncodeMBCS(PyUnicode_AS_UNICODE(uo), PyUnicode_GET_SIZE(uo), NULL); - Py_DECREF(uo); - return ret; -} -#ifdef LINK_AGAINST_RECORDINFO -// Helpers to avoid linking directly to these newer functions -static const IID g_IID_IRecordInfo = IID_IRecordInfo; -HRESULT PySafeArrayGetRecordInfo( SAFEARRAY * psa, IRecordInfo ** prinfo ) -{ - return SafeArrayGetRecordInfo(psa, prinfo); -} -HRESULT PyGetRecordInfoFromGuids( REFGUID g, ULONG major, ULONG minor, LCID lcid, REFGUID gti, IRecordInfo **ppr) -{ - return GetRecordInfoFromGuids( g, major, minor, lcid, gti, ppr); -} -#else - -// IID_IRecordInfo = {0000002F-0000-0000-C000-000000000046} -EXTERN_C const GUID g_IID_IRecordInfo \ - = { 0x2f, 0, 0, { 0xC0,0,0,0,0,0,0,0x46 } }; - -HRESULT PySafeArrayGetRecordInfo( SAFEARRAY * psa, IRecordInfo ** prinfo ) -{ - static HRESULT (STDAPICALLTYPE *pfnSAGRI)(SAFEARRAY *, IRecordInfo **) = NULL; - if (pfnSAGRI==NULL) { - HMODULE hmod = GetModuleHandle(_T("oleaut32.dll")); - if (hmod==NULL) - return E_NOTIMPL; - pfnSAGRI = (HRESULT (STDAPICALLTYPE *)(SAFEARRAY *, IRecordInfo **)) - GetProcAddress(hmod, "SafeArrayGetRecordInfo"); - if (pfnSAGRI==NULL) - return E_NOTIMPL; - } - return (*pfnSAGRI)(psa, prinfo); -} -HRESULT PyGetRecordInfoFromGuids( REFGUID g, ULONG major, ULONG minor, LCID lcid, REFGUID gti, IRecordInfo **ppr) -{ - static HRESULT (STDAPICALLTYPE *pfnGRIFG)(REFGUID, ULONG, ULONG, LCID, REFGUID, IRecordInfo **) = NULL; - if (pfnGRIFG==NULL) { - HMODULE hmod = GetModuleHandle(_T("oleaut32.dll")); - if (hmod==NULL) - return E_NOTIMPL; - pfnGRIFG = (HRESULT (STDAPICALLTYPE *)(REFGUID, ULONG, ULONG, LCID, REFGUID, IRecordInfo **)) - GetProcAddress(hmod, "GetRecordInfoFromGuids"); - if (pfnGRIFG==NULL) - return E_NOTIMPL; - } - return (*pfnGRIFG)(g, major, minor, lcid, gti, ppr); -} -#endif // LINK_AGAINST_RECORDINFO // The owner of the record buffer - many records may point here! class PyRecordBuffer @@ -78,14 +19,7 @@ } ~PyRecordBuffer() { - if (data) PyMem_Free( -#ifdef ANY // Python lost ANY in 2.2, but fails to build with "void *" in 1.5 :( - (ANY *) -#else - (void *) -#endif - data); - + if (data) PyMem_Free(data); } void AddRef() { ref++; @@ -111,7 +45,7 @@ PyRecord *pyrec = (PyRecord *)ob; HRESULT hr = pyrec->pri->RecordCreateCopy(pyrec->pdata, &V_RECORD(pv)); if (FAILED(hr)) { - PyCom_BuildPyException(hr, pyrec->pri, g_IID_IRecordInfo); + PyCom_BuildPyException(hr, pyrec->pri, IID_IRecordInfo); return FALSE; } V_RECORDINFO(pv) = pyrec->pri; @@ -127,7 +61,7 @@ long lbound, ubound, nelems, i; ULONG cb_elem; PyRecordBuffer *owner = NULL; - HRESULT hr = PySafeArrayGetRecordInfo(psa, &info); + HRESULT hr = SafeArrayGetRecordInfo(psa, &info); if (FAILED(hr)) goto exit; hr = SafeArrayAccessData(psa, (void **)&source_data); if (FAILED(hr)) goto exit; @@ -160,7 +94,7 @@ exit: if (FAILED(hr)) { if (info) - PyCom_BuildPyException(hr, info, g_IID_IRecordInfo); + PyCom_BuildPyException(hr, info, IID_IRecordInfo); else PyCom_BuildPyException(hr); Py_XDECREF(ret); @@ -180,7 +114,7 @@ ULONG cb; HRESULT hr = ri->GetSize(&cb); if (FAILED(hr)) - return PyCom_BuildPyException(hr, ri, g_IID_IRecordInfo); + return PyCom_BuildPyException(hr, ri, IID_IRecordInfo); if (cbData != 0 && cbData != cb) return PyErr_Format(PyExc_ValueError, "Expecting a string of %d bytes (got %d)", cb, cbData); PyRecordBuffer *owner = new PyRecordBuffer(cb); @@ -191,12 +125,12 @@ hr = ri->RecordInit(owner->data); if (FAILED(hr)) { delete owner; - return PyCom_BuildPyException(hr, ri, g_IID_IRecordInfo); + return PyCom_BuildPyException(hr, ri, IID_IRecordInfo); } hr = data==NULL ? 0 : ri->RecordCopy(data, owner->data); if (FAILED(hr)) { delete owner; - return PyCom_BuildPyException(hr, ri, g_IID_IRecordInfo); + return PyCom_BuildPyException(hr, ri, IID_IRecordInfo); } return new PyRecord(ri, owner->data, owner); } @@ -224,7 +158,7 @@ if (!PyWinObject_AsIID(obInfoGuid, &infoGuid)) return NULL; IRecordInfo *i = NULL; - HRESULT hr = PyGetRecordInfoFromGuids(guid, major, minor, lcid, infoGuid, &i); + HRESULT hr = GetRecordInfoFromGuids(guid, major, minor, lcid, infoGuid, &i); if (FAILED(hr)) return PyCom_BuildPyException(hr); PyObject *ret = PyObject_FromRecordInfo(i, data, cb); @@ -390,7 +324,7 @@ ULONG num_names; HRESULT hr = pri->GetFieldNames(&num_names, NULL); if (FAILED(hr)) { - PyCom_BuildPyException(hr, pri, g_IID_IRecordInfo); + PyCom_BuildPyException(hr, pri, IID_IRecordInfo); return NULL; } BSTR *strings = new BSTR [num_names]; @@ -403,7 +337,7 @@ hr = pri->GetFieldNames(&num_names, strings); if (FAILED(hr)) { - PyCom_BuildPyException(hr, pri, g_IID_IRecordInfo); + PyCom_BuildPyException(hr, pri, IID_IRecordInfo); return NULL; } *pnum = num_names; @@ -515,14 +449,14 @@ ULONG cnames = 0; HRESULT hr = pyrec->pri->GetFieldNames(&cnames, NULL); if (FAILED(hr)) - return PyCom_BuildPyException(hr, pyrec->pri, g_IID_IRecordInfo); + return PyCom_BuildPyException(hr, pyrec->pri, IID_IRecordInfo); BSTR *strs = (BSTR *)malloc(sizeof(BSTR) * cnames); if (strs==NULL) return PyErr_NoMemory(); hr = pyrec->pri->GetFieldNames(&cnames, strs); if (FAILED(hr)) { free(strs); - return PyCom_BuildPyException(hr, pyrec->pri, g_IID_IRecordInfo); + return PyCom_BuildPyException(hr, pyrec->pri, IID_IRecordInfo); } res = PyList_New(cnames); for (ULONG i=0;i<cnames && res != NULL;i++) { @@ -565,7 +499,7 @@ PyErr_SetObject(PyExc_AttributeError, obname); return NULL; } - return PyCom_BuildPyException(hr, pyrec->pri, g_IID_IRecordInfo); + return PyCom_BuildPyException(hr, pyrec->pri, IID_IRecordInfo); } // Short-circuit sub-structs and arrays here, so we dont allocate a new chunk @@ -589,7 +523,7 @@ if (FAILED(hr)) goto array_end; hr = SafeArrayGetLBound(psa, 1, &lbound); if (FAILED(hr)) goto array_end; - hr = PySafeArrayGetRecordInfo(psa, &sub); + hr = SafeArrayGetRecordInfo(psa, &sub); if (FAILED(hr)) goto array_end; hr = sub->GetSize(&element_size); if (FAILED(hr)) goto array_end; @@ -605,13 +539,17 @@ if (sub) sub->Release(); if (FAILED(hr)) - return PyCom_BuildPyException(hr, pyrec->pri, g_IID_IRecordInfo); + return PyCom_BuildPyException(hr, pyrec->pri, IID_IRecordInfo); return ret_tuple; } - // The rest of the object as passed as "BYREF VT_INT, or BYREF VT_STRING" // This default conversion we use is a little slow (but it will do!) + // For arrays, the pparray->pvData member is *not* set, since the actual data + // pointer from the record is returned in sub_data, so set it here. + if (V_ISARRAY(&vret) && V_ISBYREF(&vret)) + (*V_ARRAYREF(&vret))->pvData = sub_data; PyObject *ret = PyCom_PyObjectFromVariant(&vret); + // VariantClear(&vret); return ret; } @@ -619,6 +557,7 @@ int PyRecord::setattro(PyObject *self, PyObject *obname, PyObject *v) { VARIANT val; + VariantInit(&val); PyRecord *pyrec = (PyRecord *)self; if (!PyCom_VariantFromPyObject(v, &val)) @@ -634,7 +573,7 @@ PyWinObject_FreeWCHAR(wname); VariantClear(&val); if (FAILED(hr)) { - PyCom_BuildPyException(hr, pyrec->pri, g_IID_IRecordInfo); + PyCom_BuildPyException(hr, pyrec->pri, IID_IRecordInfo); return -1; } return 0; |
|
From: <pyw...@li...> - 2012-04-08 06:56:50
|
changeset 7b09e7868706 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=7b09e7868706 summary: Fix HierList attribute lookup in Python 2.x diffstat: Pythonwin/pywin/tools/hierlist.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r c5c768dabcbd -r 7b09e7868706 Pythonwin/pywin/tools/hierlist.py --- a/Pythonwin/pywin/tools/hierlist.py Sun Feb 12 17:22:42 2012 +1100 +++ b/Pythonwin/pywin/tools/hierlist.py Sat Apr 07 17:26:31 2012 -0400 @@ -59,7 +59,7 @@ try: return getattr(self.listControl, attr) except AttributeError: - return getattr(self, attr) + return object.Object.__getattr__(self, attr) def ItemFromHandle(self, handle): return self.itemHandleMap[handle] |
|
From: <pyw...@li...> - 2012-02-12 06:24:29
|
changeset 372a56290024 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=372a56290024 summary: tweaks to changes changeset d9b6c0a8d754 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=d9b6c0a8d754 summary: fix case of files and remove swig_py3k.exe changeset 0ff0ae96efcb in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=0ff0ae96efcb summary: get all tests/samples working in py3k changeset 28d827695ce2 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=28d827695ce2 summary: use public apis for utf8 conversion changeset 1284007afcc8 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=1284007afcc8 summary: ensure we use \r\n line terminators so the install window wraps correctly changeset 5c3a57938569 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=5c3a57938569 summary: build 217 and tweaks to the manifest hacks changeset d6992c8992c7 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=d6992c8992c7 summary: Added tag b217 for changeset 5c3a57938569 changeset c5c768dabcbd in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=c5c768dabcbd summary: merge diffstat: .hgtags | 95 +++++++++++++++++++------------------- CHANGES.txt | 11 ++- MANIFEST.in | 57 +++++++++++----------- Pythonwin/pywin/scintilla/find.py | 1 + isapi/samples/advanced.py | 4 +- isapi/samples/test.py | 4 +- isapi/src/Utils.cpp | 18 ++---- pywin32_postinstall.py | 2 +- setup.py | 47 +++++++++++++----- 9 files changed, 128 insertions(+), 111 deletions(-) diffs (truncated from 401 to 300 lines): diff -r 8fc48a195771 -r c5c768dabcbd .hgtags --- a/.hgtags Thu Jan 19 13:55:10 2012 +1100 +++ b/.hgtags Sun Feb 12 17:22:42 2012 +1100 @@ -1,47 +1,48 @@ -41f1bd66b7021c117875e6b682c497ed6fc2cc10 b206 -3f840c6cf56d1cebf71f6431a4e0efbdfdbad67f b207 -f661faf30bc176e8c7da0f270cacc6efeec6f93b b200 -3cc78fc452fc36735ad7657d55ada4a8c707ce98 b201 -e9680446f9501cea73d8c7cbb4f605ac4735f9f7 b134 -21b963e6aef75c4200cffad4e1d82f00ea7f4004 b135 -5772e8f5879d4e99bd8f011ebd6e22ac77b62326 b132 -cfc3d45d90b99ba94f2a4f0959bc87929c6bd467 b205 -509f3e5d7cf8a3538107fd16f0082c2cbfc6969b b130 -1c7f25ac9159234948ab5b6dc90bbb4a40cdb004 b131 -18e90fae54ee83cd4e843eea420363238310bad7 b208 -66090658b3de364fc0c82f8ba50c8e53c6656c31 b209 -fc11455ae6b156ef2f5de8c9278249ca331f62d0 py3k-merge-complete -be3f97064797e0ca0cd74e9eaa87165e10f7cad1 ActivePython210 -dc1672d20522850fae56111e22ccb5685f42f595 ActivePython211 -4273326c4e0d7bf084a6f9b2053d932e22a931be b157 -c29a3a48e23333cf69bf06e38709fb95dc1c4e0b b151 -84e9214951e2e643b4cc69f3aeb65096a9084333 b153 -627797aca18f5da4f850d1ce7a3b92551a00d9dc b159 -4381189ca772314be36c8f3ab6405df2b0e3054c b214 -6c8737a7ad24df7221bb5185454b9eea9ace1e43 b139 -78f2b0c832f605e114e054428b0c7cbb5b604b3f adodbapi_2_1 -0059bca6a08fd0f53ed15c53dd9c7cdf4f30277a b213 -e2bf22f83e33af157d585b97c84396a9e29517e2 b212 -2d64b7bd69085ff1a205082a342ceaa901b315db b211 -0368e8bf35fe715afdc8cd4e0f14207395d57b0f a2 -a9c6f2e0d1c9abe01912609898571aa392b872c7 b216 -3ed66b823bbf0deb92a34c86dd1dd6814bb48c5e b127 -389edbdcad88a68b57d3d4a75bc86c8804cf49c0 b126 -cc382129d3bedf1392fbb44b9ded529ff6b4de0e b129 -b64d19fa71db1cbc33c29d6ba5b4941beae80c8e b128 -9f6fdae45eb75468d6c09c77782219879c4c50bf b215 -06b7c2aead8d38bb7364b4efbdff51e5afb7f839 b147 -bdd4dbfaa9bc4b4758a912daeb8d30c3ec12d081 b146 -9dbc9b744bd27066f74d9c09da70866d99fe71f7 b145 -81514808c099a0060e5318b7e5dc1c53c6ebb3ab ActivePython202 -7900668f7ffb11e819e1a3ae8755f86c89552fcd b142 -917d31f81f0044a01c2c3516e2cf080a33206f97 b141 -1a192704d03f2c0b9cd0fb7fa59b6df51b696973 b140 -59e2f06b53e4d3ea81109e76bd686677d34d21f4 adodbapi_2_2_2 -972b58e9f118695958deebe404726e4f957f0e8b b202 -54c1f0e5035e1bd2cd38761b830778f91fd0f1d0 b149 -f21d815cbde468897d74c4f9c4de09ab8306c405 b148 -a8e244f6bb667d07c1d4b4ad1e163f3a99f7eaae b203 -b634f1c59fb9b502d2c1ee9e692e4067d7940901 b129f -c3eb7ad6c64194e120ad9037fa6299b7c6a6ef1e b204 -6ccccc93a646531a4fb0d904b83e18d324c59d01 cvs2hg +41f1bd66b7021c117875e6b682c497ed6fc2cc10 b206 +3f840c6cf56d1cebf71f6431a4e0efbdfdbad67f b207 +f661faf30bc176e8c7da0f270cacc6efeec6f93b b200 +3cc78fc452fc36735ad7657d55ada4a8c707ce98 b201 +e9680446f9501cea73d8c7cbb4f605ac4735f9f7 b134 +21b963e6aef75c4200cffad4e1d82f00ea7f4004 b135 +5772e8f5879d4e99bd8f011ebd6e22ac77b62326 b132 +cfc3d45d90b99ba94f2a4f0959bc87929c6bd467 b205 +509f3e5d7cf8a3538107fd16f0082c2cbfc6969b b130 +1c7f25ac9159234948ab5b6dc90bbb4a40cdb004 b131 +18e90fae54ee83cd4e843eea420363238310bad7 b208 +66090658b3de364fc0c82f8ba50c8e53c6656c31 b209 +fc11455ae6b156ef2f5de8c9278249ca331f62d0 py3k-merge-complete +be3f97064797e0ca0cd74e9eaa87165e10f7cad1 ActivePython210 +dc1672d20522850fae56111e22ccb5685f42f595 ActivePython211 +4273326c4e0d7bf084a6f9b2053d932e22a931be b157 +c29a3a48e23333cf69bf06e38709fb95dc1c4e0b b151 +84e9214951e2e643b4cc69f3aeb65096a9084333 b153 +627797aca18f5da4f850d1ce7a3b92551a00d9dc b159 +4381189ca772314be36c8f3ab6405df2b0e3054c b214 +6c8737a7ad24df7221bb5185454b9eea9ace1e43 b139 +78f2b0c832f605e114e054428b0c7cbb5b604b3f adodbapi_2_1 +0059bca6a08fd0f53ed15c53dd9c7cdf4f30277a b213 +e2bf22f83e33af157d585b97c84396a9e29517e2 b212 +2d64b7bd69085ff1a205082a342ceaa901b315db b211 +0368e8bf35fe715afdc8cd4e0f14207395d57b0f a2 +a9c6f2e0d1c9abe01912609898571aa392b872c7 b216 +3ed66b823bbf0deb92a34c86dd1dd6814bb48c5e b127 +389edbdcad88a68b57d3d4a75bc86c8804cf49c0 b126 +cc382129d3bedf1392fbb44b9ded529ff6b4de0e b129 +b64d19fa71db1cbc33c29d6ba5b4941beae80c8e b128 +9f6fdae45eb75468d6c09c77782219879c4c50bf b215 +06b7c2aead8d38bb7364b4efbdff51e5afb7f839 b147 +bdd4dbfaa9bc4b4758a912daeb8d30c3ec12d081 b146 +9dbc9b744bd27066f74d9c09da70866d99fe71f7 b145 +81514808c099a0060e5318b7e5dc1c53c6ebb3ab ActivePython202 +7900668f7ffb11e819e1a3ae8755f86c89552fcd b142 +917d31f81f0044a01c2c3516e2cf080a33206f97 b141 +1a192704d03f2c0b9cd0fb7fa59b6df51b696973 b140 +59e2f06b53e4d3ea81109e76bd686677d34d21f4 adodbapi_2_2_2 +972b58e9f118695958deebe404726e4f957f0e8b b202 +54c1f0e5035e1bd2cd38761b830778f91fd0f1d0 b149 +f21d815cbde468897d74c4f9c4de09ab8306c405 b148 +a8e244f6bb667d07c1d4b4ad1e163f3a99f7eaae b203 +b634f1c59fb9b502d2c1ee9e692e4067d7940901 b129f +c3eb7ad6c64194e120ad9037fa6299b7c6a6ef1e b204 +6ccccc93a646531a4fb0d904b83e18d324c59d01 cvs2hg +5c3a57938569a9a0321b59037bddf99721f61f95 b217 diff -r 8fc48a195771 -r c5c768dabcbd CHANGES.txt --- a/CHANGES.txt Thu Jan 19 13:55:10 2012 +1100 +++ b/CHANGES.txt Sun Feb 12 17:22:42 2012 +1100 @@ -6,6 +6,8 @@ Since build 216: ---------------- +* ISAPI extension works with Python 3.x + * 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) @@ -59,12 +61,13 @@ * Source-code management moved from CVS to Mercurual. -* win32com.shell - Added SHCreateShellItem +* win32com.shell - Added SHCreateShellItem and fixed some 64bit issues. -* win32evtlog - Added some of the new event log functions introduced in Vista/Windows 7 +* win32evtlog - Added some of the new event log functions introduced in + Vista/Windows 7 -* win32service - Added EnumServicesStatusEx, and support startup type "delayed" - for Python services +* win32service - Added EnumServicesStatusEx, and support startup type + "delayed" for Python services * win32net - Fix a problem with NetFileEnum on 64-bit (bug #3376041) diff -r 8fc48a195771 -r c5c768dabcbd MANIFEST.in --- a/MANIFEST.in Thu Jan 19 13:55:10 2012 +1100 +++ b/MANIFEST.in Sun Feb 12 17:22:42 2012 +1100 @@ -89,35 +89,35 @@ include com/win32comext/directsound/test/*.wav # Pythonwin -include pythonwin/pythonwin.cpp -include pythonwin/pythonwin.rc -include pythonwin/stdafxpw.cpp -include pythonwin/*.dsp -include pythonwin/*.h -include pythonwin/res/*.ico -include pythonwin/res/*.ICO -include pythonwin/res/*.bmp -include pythonwin/res/*.BMP -include pythonwin/pywin/*.cfg -include pythonwin/pywin/Demos/*.py -include pythonwin/pywin/Demos/*.txt -include pythonwin/pywin/Demos/app/*.py -include pythonwin/pywin/Demos/app/*.txt -include pythonwin/pywin/Demos/ocx/*.py -include pythonwin/License.txt +include Pythonwin/pythonwin.cpp +include Pythonwin/pythonwin.rc +include Pythonwin/stdafxpw.cpp +include Pythonwin/*.dsp +include Pythonwin/*.h +include Pythonwin/res/*.ico +include Pythonwin/res/*.ICO +include Pythonwin/res/*.bmp +include Pythonwin/res/*.BMP +include Pythonwin/pywin/*.cfg +include Pythonwin/pywin/Demos/*.py +include Pythonwin/pywin/Demos/*.txt +include Pythonwin/pywin/Demos/app/*.py +include Pythonwin/pywin/Demos/app/*.txt +include Pythonwin/pywin/Demos/ocx/*.py +include Pythonwin/License.txt # scintilla -include pythonwin/Scintilla/README* -include pythonwin/Scintilla/License.txt -include pythonwin/Scintilla/makefile_pythonwin -include pythonwin/Scintilla/update.bat -include pythonwin/Scintilla/include/* -include pythonwin/Scintilla/src/* -include pythonwin/Scintilla/win32/*.cxx -include pythonwin/Scintilla/win32/*.h -include pythonwin/Scintilla/win32/*.rc -include pythonwin/Scintilla/win32/*.def -include pythonwin/Scintilla/win32/*.mak -include pythonwin/Scintilla/win32/*.cur +include Pythonwin/Scintilla/README* +include Pythonwin/Scintilla/License.txt +include Pythonwin/Scintilla/makefile_pythonwin +include Pythonwin/Scintilla/update.bat +include Pythonwin/Scintilla/include/* +include Pythonwin/Scintilla/src/* +include Pythonwin/Scintilla/win32/*.cxx +include Pythonwin/Scintilla/win32/*.h +include Pythonwin/Scintilla/win32/*.rc +include Pythonwin/Scintilla/win32/*.def +include Pythonwin/Scintilla/win32/*.mak +include Pythonwin/Scintilla/win32/*.cur # ISAPI include isapi/doc/*.html @@ -136,7 +136,6 @@ # Other tools include SWIG/swig.exe -include SWIG/swig_py3k.exe include SWIG/readme.txt include SWIG/swig_lib/*.i include SWIG/swig_lib/*.swg diff -r 8fc48a195771 -r c5c768dabcbd Pythonwin/pywin/scintilla/find.py --- a/Pythonwin/pywin/scintilla/find.py Thu Jan 19 13:55:10 2012 +1100 +++ b/Pythonwin/pywin/scintilla/find.py Sun Feb 12 17:22:42 2012 +1100 @@ -321,6 +321,7 @@ control.SetSel(0) num = 0 if self.DoFindNext() == FOUND_NORMAL: + num = 1 lastSearch.replaceText = self.editReplaceText.GetWindowText() while _ReplaceIt(control) == FOUND_NORMAL: num = num + 1 diff -r 8fc48a195771 -r c5c768dabcbd isapi/samples/advanced.py --- a/isapi/samples/advanced.py Thu Jan 19 13:55:10 2012 +1100 +++ b/isapi/samples/advanced.py Sun Feb 12 17:22:42 2012 +1100 @@ -85,7 +85,7 @@ win32file.FindNextChangeNotification(self.handle) except win32event.error, details: # handle closed - thread should terminate. - if details[0] != winerror.ERROR_INVALID_HANDLE: + if details.winerror != winerror.ERROR_INVALID_HANDLE: raise break this_time = os.stat(self.filename)[stat.ST_MTIME] @@ -114,7 +114,7 @@ print "Doing reload" raise InternalReloadException - url = ecb.GetServerVariable("URL") + url = ecb.GetServerVariable("UNICODE_URL") if url.endswith("ReportUnhealthy"): ecb.ReportUnhealthy("I'm a little sick") diff -r 8fc48a195771 -r c5c768dabcbd isapi/samples/test.py --- a/isapi/samples/test.py Thu Jan 19 13:55:10 2012 +1100 +++ b/isapi/samples/test.py Sun Feb 12 17:22:42 2012 +1100 @@ -36,7 +36,7 @@ win32file.FindNextChangeNotification(self.handle) except win32event.error, details: # handle closed - thread should terminate. - if details[0] != winerror.ERROR_INVALID_HANDLE: + if details.winerror != winerror.ERROR_INVALID_HANDLE: raise break this_time = os.stat(self.filename)[stat.ST_MTIME] @@ -69,7 +69,7 @@ print "Doing reload" raise InternalReloadException - if ecb.GetServerVariable("URL").endswith("test.py"): + if ecb.GetServerVariable("UNICODE_URL").endswith("test.py"): file_flags = win32con.FILE_FLAG_SEQUENTIAL_SCAN | win32con.FILE_FLAG_OVERLAPPED hfile = win32file.CreateFile(__file__, win32con.GENERIC_READ, 0, None, win32con.OPEN_EXISTING, diff -r 8fc48a195771 -r c5c768dabcbd isapi/src/Utils.cpp --- a/isapi/src/Utils.cpp Thu Jan 19 13:55:10 2012 +1100 +++ b/isapi/src/Utils.cpp Sun Feb 12 17:22:42 2012 +1100 @@ -35,19 +35,11 @@ // some py3k-friendly type conversions. const char *PyISAPIString_AsBytes(PyObject *ob, DWORD *psize /* = NULL */) { + PyObject *obNew = NULL; #if (PY_VERSION_HEX >= 0x03000000) - // py3k - check for unicode object and use default encoding. + // py3k - check for unicode object and use utf-8 encoding. if (PyUnicode_Check(ob)) { - // NOTE: we are using an internal API and it may go away later. - // The implementation in py3k is simply "encode as utf-8" - but using - // this makes our life a little simpler (the value is cached and we - // don't need to manage reference counts) so we stick with it. - // Sadly this changed in 3.3 though... -#if (PY_VERSION_HEX >= 0x03030000) - ob = _PyUnicode_AsDefaultEncodedString(ob); -#else - ob = _PyUnicode_AsDefaultEncodedString(ob, NULL); -#endif + obNew = ob = PyUnicode_AsUTF8String(ob); if (ob == NULL) return NULL; } @@ -59,7 +51,9 @@ } if (psize) *psize = PyString_Size(ob); - return PyString_AsString(ob); + const char *result = PyString_AsString(ob); + Py_XDECREF(obNew); + return result; } // returns the pathname of this module diff -r 8fc48a195771 -r c5c768dabcbd pywin32_postinstall.py --- a/pywin32_postinstall.py Thu Jan 19 13:55:10 2012 +1100 +++ b/pywin32_postinstall.py Sun Feb 12 17:22:42 2012 +1100 @@ -14,7 +14,7 @@ def write(self, what): if self.f is not None: |
|
From: <pyw...@li...> - 2012-02-11 22:16:34
|
changeset 60e8e48fe924 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=60e8e48fe924 summary: Fix replace count diffstat: Pythonwin/pywin/scintilla/find.py | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diffs (11 lines): diff -r 8fc48a195771 -r 60e8e48fe924 Pythonwin/pywin/scintilla/find.py --- a/Pythonwin/pywin/scintilla/find.py Thu Jan 19 13:55:10 2012 +1100 +++ b/Pythonwin/pywin/scintilla/find.py Sat Feb 11 17:15:40 2012 -0500 @@ -321,6 +321,7 @@ control.SetSel(0) num = 0 if self.DoFindNext() == FOUND_NORMAL: + num = 1 lastSearch.replaceText = self.editReplaceText.GetWindowText() while _ReplaceIt(control) == FOUND_NORMAL: num = num + 1 |
|
From: <pyw...@li...> - 2012-01-19 02:56:09
|
changeset bd57d6c69bb0 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=bd57d6c69bb0 summary: show how a shell context menu extension can show multiple items changeset 8fc48a195771 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=8fc48a195771 summary: fix occasional exception in pythonwin's ImportFile (bug 3438431) diffstat: Pythonwin/pywin/framework/scriptutils.py | 6 +++++- com/win32comext/shell/demos/servers/context_menu.py | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diffs (41 lines): diff -r 57fc41295aa0 -r 8fc48a195771 Pythonwin/pywin/framework/scriptutils.py --- a/Pythonwin/pywin/framework/scriptutils.py Mon Jan 02 18:43:11 2012 +1100 +++ b/Pythonwin/pywin/framework/scriptutils.py Thu Jan 19 13:55:10 2012 +1100 @@ -393,7 +393,11 @@ path, modName = os.path.split(pathName) modName, modExt = os.path.splitext(modName) newPath = None - for key, mod in sys.modules.iteritems(): + # note that some packages (*cough* email *cough*) use "lazy importers" + # meaning sys.modules can change as a side-effect of looking at + # module.__file__ - so we must take a copy (ie, items() in py2k, + # list(items()) in py3k) + for key, mod in sys.modules.items(): if hasattr(mod, '__file__'): fname = mod.__file__ base, ext = os.path.splitext(fname) diff -r 57fc41295aa0 -r 8fc48a195771 com/win32comext/shell/demos/servers/context_menu.py --- a/com/win32comext/shell/demos/servers/context_menu.py Mon Jan 02 18:43:11 2012 +1100 +++ b/com/win32comext/shell/demos/servers/context_menu.py Thu Jan 19 13:55:10 2012 +1100 @@ -36,7 +36,7 @@ fname = shell.DragQueryFile(sm.data_handle, 0) msg = "&Hello from Python (with '%s' selected)" % fname idCmd = idCmdFirst - items = [] + items = ['First Python content menu item'] if (uFlags & 0x000F) == shellcon.CMF_NORMAL: # Check == here, since CMF_NORMAL=0 print "CMF_NORMAL..." items.append(msg) @@ -72,7 +72,11 @@ win32gui.MessageBox(hwnd, "Hello", "Wow", win32con.MB_OK) def GetCommandString(self, cmd, typ): - return "Hello from Python!!" + # If GetCommandString returns the same string for all items then + # the shell seems to ignore all but one. This is even true in + # Win7 etc where there is no status bar (and hence this string seems + # ignored) + return "Hello from Python (cmd=%d)!!" % (cmd,) def DllRegisterServer(): import _winreg |
|
From: <pyw...@li...> - 2012-01-02 07:46:12
|
changeset 57fc41295aa0 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=57fc41295aa0 summary: treat flags and range for win32file.LockFileEx to be unsigned, via #3385752 diffstat: win32/src/win32file.i | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (12 lines): diff -r cc10aa149c2c -r 57fc41295aa0 win32/src/win32file.i --- a/win32/src/win32file.i Mon Jan 02 17:53:18 2012 +1100 +++ b/win32/src/win32file.i Mon Jan 02 18:43:11 2012 +1100 @@ -1068,7 +1068,7 @@ PyObject *obOverlapped = NULL; DWORD dwFlags, nbytesLow, nbytesHigh; - if (!PyArg_ParseTuple(args, "OiiiO:LockFileEx", + if (!PyArg_ParseTuple(args, "OkkkO:LockFileEx", &obhFile, // @pyparm <o PyHANDLE>/int|hFile||Handle to the file &dwFlags, // @pyparm dwFlags|int||Flags that specify exclusive/shared and blocking/non-blocking mode &nbytesLow, // @pyparm nbytesLow|int||low-order part of number of bytes to lock |
|
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 |