pywin32-checkins Mailing List for Python for Windows Extensions (Page 62)
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: Roger U. <ru...@us...> - 2008-10-10 23:34:22
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14248 Modified Files: odbc.cpp Log Message: Correct units for microseconds in datetime fields Add space for terminating null when binding WCHAR output buffer Index: odbc.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/odbc.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** odbc.cpp 6 Oct 2008 00:40:28 -0000 1.21 --- odbc.cpp 10 Oct 2008 23:34:15 -0000 1.22 *************** *** 627,634 **** { const TIMESTAMP_STRUCT *dt = (const TIMESTAMP_STRUCT *) v; ! return PyObject_CallFunction(datetime_class, "hhhhhhl", dt->year, dt->month, dt->day, ! dt->hour, dt->minute, dt->second, dt->fraction); ! // ??? Not sure what units fraction uses ??? } --- 627,635 ---- { const TIMESTAMP_STRUCT *dt = (const TIMESTAMP_STRUCT *) v; ! // Units for fraction is billionths, python datetime uses microseconds ! unsigned long usec=dt->fraction/1000; ! return PyObject_CallFunction(datetime_class, "hhhhhhk", dt->year, dt->month, dt->day, ! dt->hour, dt->minute, dt->second, usec); } *************** *** 839,842 **** --- 840,861 ---- } + // Class to hold a temporary reference that decrements itself + class TmpPyObject + { + public: + PyObject *tmp; + TmpPyObject() { tmp=NULL; } + TmpPyObject(PyObject *ob) { tmp=ob; } + PyObject * operator= (PyObject *ob){ + Py_XDECREF(tmp); + tmp=ob; + return tmp; + } + + boolean operator== (PyObject *ob) { return tmp==ob; } + operator PyObject *() { return tmp; } + ~TmpPyObject() { Py_XDECREF(tmp); } + }; + static int ibindDate(cursorObject*cur, int column, PyObject *item) { *************** *** 846,850 **** return 0; TIMESTAMP_STRUCT *dt = (TIMESTAMP_STRUCT*) ib->bind_area ; ! ZeroMemory(dt, sizeof(*dt)); // Accept either a PyTime or datetime object if (PyTime_Check(item)){ --- 865,869 ---- return 0; TIMESTAMP_STRUCT *dt = (TIMESTAMP_STRUCT*) ib->bind_area ; ! ZeroMemory(dt, len); // Accept either a PyTime or datetime object if (PyTime_Check(item)){ *************** *** 858,886 **** dt->minute = st.wMinute; dt->second = st.wSecond; ! dt->fraction = st.wMilliseconds; ! // ??? Not sure what units fraction is in ??? } else{ // Python 2.3 doesn't have C Api for datetime ! PyObject *timeseq = PyObject_CallMethod(item, "timetuple", NULL); if (timeseq==NULL) return 0; ! PyObject *timetuple=PySequence_Tuple(timeseq); ! if (timetuple==NULL){ ! Py_DECREF(timeseq); return 0; ! } ! // Last 3 items are ignored. Need to figure out how to get fractional seconds also. PyObject *obwday, *obyday, *obdst; ! if (!PyArg_ParseTuple(timetuple, "hhh|hhhOOO:TIMESTAMP_STRUCT", &dt->year, &dt->month, &dt->day, &dt->hour, &dt->minute, &dt->second, ! &obwday, &obyday, &obdst)){ ! Py_DECREF(timeseq); ! Py_DECREF(timetuple); return 0; } ! Py_DECREF(timeseq); ! Py_DECREF(timetuple); } --- 877,909 ---- dt->minute = st.wMinute; dt->second = st.wSecond; ! // Fraction is in nanoseconds ! dt->fraction = st.wMilliseconds * 1000000; } else{ // Python 2.3 doesn't have C Api for datetime ! TmpPyObject timeseq = PyObject_CallMethod(item, "timetuple", NULL); if (timeseq==NULL) return 0; ! timeseq=PySequence_Tuple(timeseq); ! if (timeseq==NULL) return 0; ! // Last 3 items are ignored. PyObject *obwday, *obyday, *obdst; ! if (!PyArg_ParseTuple(timeseq, "hhh|hhhOOO:TIMESTAMP_STRUCT", &dt->year, &dt->month, &dt->day, &dt->hour, &dt->minute, &dt->second, ! &obwday, &obyday, &obdst)) return 0; + + TmpPyObject usec=PyObject_GetAttrString(item, "microsecond"); + if (usec != NULL){ + dt->fraction=PyLong_AsUnsignedLong(usec); + if (dt->fraction == -1 && PyErr_Occurred()) + return 0; + // Convert to nanoseconds + dt->fraction *= 1000; } ! else ! PyErr_Clear(); } *************** *** 892,896 **** SQL_TIMESTAMP, len, ! 0, ib->bind_area, len, --- 915,919 ---- SQL_TIMESTAMP, len, ! 9, // Decimal digits of precision, appears to be ignored for datetime ib->bind_area, len, *************** *** 1014,1018 **** { const WCHAR *wval = (WCHAR *)PyUnicode_AsUnicode(item); ! Py_ssize_t nchars = PyUnicode_GetSize(item) + 1; Py_ssize_t nbytes = nchars * sizeof(WCHAR); --- 1037,1041 ---- { const WCHAR *wval = (WCHAR *)PyUnicode_AsUnicode(item); ! Py_ssize_t nchars = PyUnicode_GetSize(item); Py_ssize_t nbytes = nchars * sizeof(WCHAR); *************** *** 1021,1028 **** return 0; ! wcsncpy((WCHAR *)ib->bind_area, wval, nchars); /* See above re SQL_VARCHAR */ int sqlType = SQL_WVARCHAR; ! if (nbytes > 255) { ib->sqlBytesAvailable = SQL_LEN_DATA_AT_EXEC(ib->len); --- 1044,1051 ---- return 0; ! memcpy(ib->bind_area, wval, nbytes); /* See above re SQL_VARCHAR */ int sqlType = SQL_WVARCHAR; ! if (nchars > 255) { ib->sqlBytesAvailable = SQL_LEN_DATA_AT_EXEC(ib->len); *************** *** 1042,1046 **** SQL_C_WCHAR, sqlType, ! nbytes, 0, ib->bind_area, --- 1065,1069 ---- SQL_C_WCHAR, sqlType, ! nchars, 0, ib->bind_area, *************** *** 1204,1208 **** unsigned long prec; short nullok; ! short nsize = sizeof(nsize); short scale = 0; SQLDescribeCol( --- 1227,1231 ---- unsigned long prec; short nullok; ! short nsize; short scale = 0; SQLDescribeCol( *************** *** 1213,1217 **** &nsize, &vtype, ! &vsize, &scale, &nullok); --- 1236,1240 ---- &nsize, &vtype, ! &vsize, // This is column size in characters &scale, &nullok); *************** *** 1256,1260 **** dateCopy, SQL_C_TIMESTAMP, ! sizeof(TIMESTAMP_STRUCT), pos, false); --- 1279,1283 ---- dateCopy, SQL_C_TIMESTAMP, ! vsize, pos, false); *************** *** 1285,1288 **** --- 1308,1314 ---- case SQL_VARCHAR: case SQL_WVARCHAR: + bindOutputVar(cur, wcharCopy, SQL_C_WCHAR, (vsize+1)*sizeof(WCHAR), pos, false); + typeOf = DbiString; + break; case SQL_LONGVARCHAR: case SQL_WLONGVARCHAR: |
From: Roger U. <ru...@us...> - 2008-10-07 15:31:36
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3864 Modified Files: Tag: py3k win32consolemodule.cpp Log Message: Return console window handle as plaint int Index: win32consolemodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32consolemodule.cpp,v retrieving revision 1.13.2.1 retrieving revision 1.13.2.2 diff -C2 -d -r1.13.2.1 -r1.13.2.2 *** win32consolemodule.cpp 29 Aug 2008 04:59:26 -0000 1.13.2.1 --- win32consolemodule.cpp 7 Oct 2008 15:28:49 -0000 1.13.2.2 *************** *** 1912,1916 **** return NULL; h=(*pfnGetConsoleWindow)(); ! return PyWinObject_FromHANDLE(h); } --- 1912,1916 ---- return NULL; h=(*pfnGetConsoleWindow)(); ! return PyWinLong_FromHANDLE(h); } |
From: Roger U. <ru...@us...> - 2008-10-07 15:23:31
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3416 Modified Files: win32consolemodule.cpp Log Message: Return console window handle as plaint int Index: win32consolemodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32consolemodule.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** win32consolemodule.cpp 25 Jul 2008 01:18:10 -0000 1.13 --- win32consolemodule.cpp 7 Oct 2008 15:21:49 -0000 1.14 *************** *** 1903,1907 **** return NULL; h=(*pfnGetConsoleWindow)(); ! return PyWinObject_FromHANDLE(h); } --- 1903,1907 ---- return NULL; h=(*pfnGetConsoleWindow)(); ! return PyWinLong_FromHANDLE(h); } |
From: Roger U. <ru...@us...> - 2008-10-07 15:17:34
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv3077 Modified Files: win32ImageList.cpp Log Message: Prevent annoying "pure virtual function call" popup when closing Pythonwin_d Index: win32ImageList.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32ImageList.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** win32ImageList.cpp 3 Jun 2007 12:35:57 -0000 1.3 --- win32ImageList.cpp 7 Oct 2008 15:14:03 -0000 1.4 *************** *** 31,35 **** { CImageList::Dump(dc); ! DumpAssocPyObject(dc, (void *)this); } #endif --- 31,35 ---- { CImageList::Dump(dc); ! // DumpAssocPyObject(dc, (void *)this); } #endif |
From: Mark H. <mha...@us...> - 2008-10-07 11:35:43
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22754/win32/src Modified Files: Tag: py3k PyWinTypesmodule.cpp Log Message: merge trunk changes to exception args handling. Index: PyWinTypesmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypesmodule.cpp,v retrieving revision 1.39.2.6 retrieving revision 1.39.2.7 diff -C2 -d -r1.39.2.6 -r1.39.2.7 *** PyWinTypesmodule.cpp 4 Oct 2008 04:10:23 -0000 1.39.2.6 --- PyWinTypesmodule.cpp 7 Oct 2008 11:35:36 -0000 1.39.2.7 *************** *** 870,890 **** // Note using 'super()' doesn't work as expected on py23... PyObject *res=PyRun_String( ! "class error(Exception):\n" ! " def __init__(self, *args, **kw):\n" ! " self.winerror, self.funcname, self.strerror = args[:3]\n" ! " Exception.__init__(self, *args, **kw)\n" ! "class com_error(Exception):\n" ! " def __init__(self, *args, **kw):\n" ! " self.hresult = args[0]\n" ! " if len(args)>1: self.strerror = args[1]\n" ! " else: self.strerror = None\n" ! " if len(args)>2: self.excepinfo = args[2]\n" ! " else: self.excepinfo = None\n" ! " if len(args)>3: self.argerror = args[3]\n" ! " else: self.argerror = None\n" ! " Exception.__init__(self, *args, **kw)\n" ! , ! Py_file_input, d, d); if (res==NULL) return -1; --- 870,899 ---- // Note using 'super()' doesn't work as expected on py23... + // Need to be careful to support "insane" args... PyObject *res=PyRun_String( ! "class error(Exception):\n" ! " def __init__(self, *args, **kw):\n" ! " nargs = len(args)\n" ! " if nargs > 0: self.winerror = args[0]\n" ! " else: self.winerror = None\n" ! " if nargs > 1: self.funcname = args[1]\n" ! " else: self.funcname = None\n" ! " if nargs > 2: self.strerror = args[2]\n" ! " else: self.strerror = None\n" ! " Exception.__init__(self, *args, **kw)\n" ! "class com_error(Exception):\n" ! " def __init__(self, *args, **kw):\n" ! " nargs = len(args)\n" ! " if nargs > 0: self.hresult = args[0]\n" ! " else: self.hresult = None\n" ! " if nargs > 1: self.strerror = args[1]\n" ! " else: self.strerror = None\n" ! " if nargs > 2: self.excepinfo = args[2]\n" ! " else: self.excepinfo = None\n" ! " if nargs > 3: self.argerror = args[3]\n" ! " else: self.argerror = None\n" ! " Exception.__init__(self, *args, **kw)\n" ! , ! Py_file_input, d, d); if (res==NULL) return -1; |
From: Mark H. <mha...@us...> - 2008-10-07 11:35:43
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22754/win32/test Modified Files: Tag: py3k test_exceptions.py Log Message: merge trunk changes to exception args handling. Index: test_exceptions.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/test_exceptions.py,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -C2 -d -r1.2.2.3 -r1.2.2.4 *** test_exceptions.py 1 Oct 2008 08:10:11 -0000 1.2.2.3 --- test_exceptions.py 7 Oct 2008 11:35:36 -0000 1.2.2.4 *************** *** 1,3 **** --- 1,4 ---- """Test pywin32's error semantics""" + import sys import unittest import win32api, win32file, pywintypes *************** *** 83,86 **** --- 84,120 ---- self.failUnlessEqual(exc.funcname, 'CloseHandle') + # some tests for 'insane' args. + def testStrangeArgsNone(self): + try: + raise pywintypes.error() + self.fail("Expected exception") + except pywintypes.error, exc: + self.failUnlessEqual(exc.args, ()) + self.failUnlessEqual(exc.winerror, None) + self.failUnlessEqual(exc.funcname, None) + self.failUnlessEqual(exc.strerror, None) + + def testStrangeArgsNotEnough(self): + try: + raise pywintypes.error("foo") + self.fail("Expected exception") + except pywintypes.error, exc: + assert exc.args[0] == "foo" + # 'winerror' always args[0] + self.failUnlessEqual(exc.winerror, "foo") + self.failUnlessEqual(exc.funcname, None) + self.failUnlessEqual(exc.strerror, None) + + def testStrangeArgsTooMany(self): + try: + raise pywintypes.error("foo", "bar", "you", "never", "kn", 0) + self.fail("Expected exception") + except pywintypes.error, exc: + self.failUnlessEqual(exc.args[0], "foo") + self.failUnlessEqual(exc.args[-1], 0) + self.failUnlessEqual(exc.winerror, "foo") + self.failUnlessEqual(exc.funcname, "bar") + self.failUnlessEqual(exc.strerror, "you") + class TestCOMSimple(TestBase): def _getException(self): *************** *** 142,146 **** self.failUnlessEqual(exc.argerror, None) self.failUnlessEqual(exc.excepinfo, None) ! if __name__ == '__main__': unittest.main() --- 176,214 ---- self.failUnlessEqual(exc.argerror, None) self.failUnlessEqual(exc.excepinfo, None) ! ! def testStrangeArgsNone(self): ! try: ! raise pywintypes.com_error() ! self.fail("Expected exception") ! except pywintypes.com_error, exc: ! self.failUnlessEqual(exc.args, ()) ! self.failUnlessEqual(exc.hresult, None) ! self.failUnlessEqual(exc.strerror, None) ! self.failUnlessEqual(exc.argerror, None) ! self.failUnlessEqual(exc.excepinfo, None) ! ! def testStrangeArgsNotEnough(self): ! try: ! raise pywintypes.com_error("foo") ! self.fail("Expected exception") ! except pywintypes.com_error, exc: ! self.failUnlessEqual(exc.args[0], "foo") ! self.failUnlessEqual(exc.hresult, "foo") ! self.failUnlessEqual(exc.strerror, None) ! self.failUnlessEqual(exc.excepinfo, None) ! self.failUnlessEqual(exc.argerror, None) ! ! def testStrangeArgsTooMany(self): ! try: ! raise pywintypes.com_error("foo", "bar", "you", "never", "kn", 0) ! self.fail("Expected exception") ! except pywintypes.com_error, exc: ! self.failUnlessEqual(exc.args[0], "foo") ! self.failUnlessEqual(exc.args[-1], 0) ! self.failUnlessEqual(exc.hresult, "foo") ! self.failUnlessEqual(exc.strerror, "bar") ! self.failUnlessEqual(exc.excepinfo, "you") ! self.failUnlessEqual(exc.argerror, "never") ! if __name__ == '__main__': unittest.main() |
From: Mark H. <mha...@us...> - 2008-10-07 11:32:33
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22355/win32/src Modified Files: PyWinTypesmodule.cpp Log Message: More robust handling and tests for 'insane' exception args. Index: PyWinTypesmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypesmodule.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** PyWinTypesmodule.cpp 1 Oct 2008 06:49:31 -0000 1.40 --- PyWinTypesmodule.cpp 7 Oct 2008 11:28:10 -0000 1.41 *************** *** 829,844 **** } // Note using 'super()' doesn't work as expected on py23... PyRun_String("class error(Exception):\n" " def __init__(self, *args, **kw):\n" ! " self.winerror, self.funcname, self.strerror = args[:3]\n" " Exception.__init__(self, *args, **kw)\n" "class com_error(Exception):\n" " def __init__(self, *args, **kw):\n" ! " self.hresult = args[0]\n" ! " if len(args)>1: self.strerror = args[1]\n" " else: self.strerror = None\n" ! " if len(args)>2: self.excepinfo = args[2]\n" " else: self.excepinfo = None\n" ! " if len(args)>3: self.argerror = args[3]\n" " else: self.argerror = None\n" " Exception.__init__(self, *args, **kw)\n" --- 829,853 ---- } // Note using 'super()' doesn't work as expected on py23... + // Need to be careful to support "insane" args... PyRun_String("class error(Exception):\n" " def __init__(self, *args, **kw):\n" ! " nargs = len(args)\n" ! " if nargs > 0: self.winerror = args[0]\n" ! " else: self.winerror = None\n" ! " if nargs > 1: self.funcname = args[1]\n" ! " else: self.funcname = None\n" ! " if nargs > 2: self.strerror = args[2]\n" ! " else: self.strerror = None\n" " Exception.__init__(self, *args, **kw)\n" "class com_error(Exception):\n" " def __init__(self, *args, **kw):\n" ! " nargs = len(args)\n" ! " if nargs > 0: self.hresult = args[0]\n" ! " else: self.hresult = None\n" ! " if nargs > 1: self.strerror = args[1]\n" " else: self.strerror = None\n" ! " if nargs > 2: self.excepinfo = args[2]\n" " else: self.excepinfo = None\n" ! " if nargs > 3: self.argerror = args[3]\n" " else: self.argerror = None\n" " Exception.__init__(self, *args, **kw)\n" |
From: Mark H. <mha...@us...> - 2008-10-07 11:32:33
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22355/win32/test Modified Files: test_exceptions.py Log Message: More robust handling and tests for 'insane' exception args. Index: test_exceptions.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/test_exceptions.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_exceptions.py 2 Oct 2008 12:09:53 -0000 1.4 --- test_exceptions.py 7 Oct 2008 11:28:10 -0000 1.5 *************** *** 1,3 **** --- 1,4 ---- """Test pywin32's error semantics""" + import sys import unittest import win32api, win32file, pywintypes *************** *** 83,86 **** --- 84,120 ---- self.failUnlessEqual(exc.funcname, 'CloseHandle') + # some tests for 'insane' args. + def testStrangeArgsNone(self): + try: + raise pywintypes.error() + self.fail("Expected exception") + except pywintypes.error, exc: + self.failUnlessEqual(exc.args, ()) + self.failUnlessEqual(exc.winerror, None) + self.failUnlessEqual(exc.funcname, None) + self.failUnlessEqual(exc.strerror, None) + + def testStrangeArgsNotEnough(self): + try: + raise pywintypes.error("foo") + self.fail("Expected exception") + except pywintypes.error, exc: + assert exc.args[0] == "foo" + # 'winerror' always args[0] + self.failUnlessEqual(exc.winerror, "foo") + self.failUnlessEqual(exc.funcname, None) + self.failUnlessEqual(exc.strerror, None) + + def testStrangeArgsTooMany(self): + try: + raise pywintypes.error("foo", "bar", "you", "never", "kn", 0) + self.fail("Expected exception") + except pywintypes.error, exc: + self.failUnlessEqual(exc.args[0], "foo") + self.failUnlessEqual(exc.args[-1], 0) + self.failUnlessEqual(exc.winerror, "foo") + self.failUnlessEqual(exc.funcname, "bar") + self.failUnlessEqual(exc.strerror, "you") + class TestCOMSimple(TestBase): def _getException(self): *************** *** 142,146 **** self.failUnlessEqual(exc.argerror, None) self.failUnlessEqual(exc.excepinfo, None) ! if __name__ == '__main__': unittest.main() --- 176,214 ---- self.failUnlessEqual(exc.argerror, None) self.failUnlessEqual(exc.excepinfo, None) ! ! def testStrangeArgsNone(self): ! try: ! raise pywintypes.com_error() ! self.fail("Expected exception") ! except pywintypes.com_error, exc: ! self.failUnlessEqual(exc.args, ()) ! self.failUnlessEqual(exc.hresult, None) ! self.failUnlessEqual(exc.strerror, None) ! self.failUnlessEqual(exc.argerror, None) ! self.failUnlessEqual(exc.excepinfo, None) ! ! def testStrangeArgsNotEnough(self): ! try: ! raise pywintypes.com_error("foo") ! self.fail("Expected exception") ! except pywintypes.com_error, exc: ! self.failUnlessEqual(exc.args[0], "foo") ! self.failUnlessEqual(exc.hresult, "foo") ! self.failUnlessEqual(exc.strerror, None) ! self.failUnlessEqual(exc.excepinfo, None) ! self.failUnlessEqual(exc.argerror, None) ! ! def testStrangeArgsTooMany(self): ! try: ! raise pywintypes.com_error("foo", "bar", "you", "never", "kn", 0) ! self.fail("Expected exception") ! except pywintypes.com_error, exc: ! self.failUnlessEqual(exc.args[0], "foo") ! self.failUnlessEqual(exc.args[-1], 0) ! self.failUnlessEqual(exc.hresult, "foo") ! self.failUnlessEqual(exc.strerror, "bar") ! self.failUnlessEqual(exc.excepinfo, "you") ! self.failUnlessEqual(exc.argerror, "never") ! if __name__ == '__main__': unittest.main() |
From: Roger U. <ru...@us...> - 2008-10-06 03:22:14
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10292 Added Files: Tag: py3k dbi.py Log Message: Add a skeleton dbi module. --- NEW FILE: dbi.py --- """ Skeleton replacement for removed dbi module. Use of objects created by this module should be replaced with native Python objects. Dates are now returned as datetime.datetime objects, but will still accept PyTime objects also. Raw data for binary fields should be passed as buffer objects for Python 2.x, and memoryview objects in Py3k. """ import warnings warnings.warn( "dbi module is obsolete, code should now use native python datetime and buffer/memoryview objects", DeprecationWarning) import datetime dbDate = dbiDate = datetime.datetime try: dbRaw = dbiRaw = buffer except NameError: dbRaw = dbiRaw = memoryview # type names are still exported by odbc module from odbc import * |
From: Roger U. <ru...@us...> - 2008-10-06 01:12:43
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11138 Modified Files: test_odbc.py Log Message: Remove rest of referenced to dbi Index: test_odbc.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/test_odbc.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_odbc.py 6 Oct 2008 00:43:57 -0000 1.9 --- test_odbc.py 6 Oct 2008 01:12:36 -0000 1.10 *************** *** 4,8 **** import unittest import odbc - import dbi import tempfile --- 4,7 ---- *************** *** 50,54 **** try: self.cur.execute("""drop table pywin32test_users""") ! except (odbc.error, dbi.progError): pass --- 49,53 ---- try: self.cur.execute("""drop table pywin32test_users""") ! except (odbc.error, odbc.progError): pass *************** *** 66,70 **** try: self.cur.execute("""drop table pywin32test_users""") ! except (odbc.error, dbi.progError), why: print "Failed to delete test table:", why --- 65,69 ---- try: self.cur.execute("""drop table pywin32test_users""") ! except (odbc.error, odbc.progError), why: print "Failed to delete test table:", why *************** *** 90,94 **** try: self.test_insert_select(userid='Frank' * 200, username='Frank Millman' * 200) ! except dbi.noError: pass --- 89,93 ---- try: self.test_insert_select(userid='Frank' * 200, username='Frank Millman' * 200) ! except odbc.noError: pass |
From: Roger U. <ru...@us...> - 2008-10-06 00:45:28
|
Update of /cvsroot/pywin32/pywin32 In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1546 Modified Files: setup.py Log Message: Remove dbi module Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** setup.py 29 Sep 2008 13:01:40 -0000 1.82 --- setup.py 6 Oct 2008 00:45:17 -0000 1.83 *************** *** 1285,1291 **** for info in ( - ("dbi", "", False), ("mmapfile", "", False), ! ("odbc", "odbc32 odbccp32 dbi", False), ("perfmon", "", True), ("timer", "user32", False), --- 1285,1290 ---- for info in ( ("mmapfile", "", False), ! ("odbc", "odbc32 odbccp32", False), ("perfmon", "", True), ("timer", "user32", False), |
From: Roger U. <ru...@us...> - 2008-10-06 00:44:08
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1157 Modified Files: test_odbc.py Log Message: Add some more tests Index: test_odbc.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/test_odbc.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_odbc.py 16 Sep 2008 00:48:07 -0000 1.8 --- test_odbc.py 6 Oct 2008 00:43:57 -0000 1.9 *************** *** 58,62 **** bitfield bit, intfield integer, floatfield float, ! datefield date )"""),-1) --- 58,63 ---- bitfield bit, intfield integer, floatfield float, ! datefield date, ! rawfield varbinary(100) )"""),-1) *************** *** 133,136 **** --- 134,147 ---- self._test_val('username', 'foo') + def testRaw(self): + ## Test binary data + self._test_val('rawfield', buffer('\1\2\3\4\0\5\6\7\8')) + + def test_widechar(self): + """Test a unicode character that would be mangled if bound as plain character. + For example, previously the below was returned as ascii 'a' + """ + self._test_val('username', u'\u0101') + def testDates(self): import datetime |
From: Roger U. <ru...@us...> - 2008-10-06 00:42:59
|
Update of /cvsroot/pywin32/pywin32/win32 In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv714 Removed Files: dbi.dsp Log Message: Remove dbi module --- dbi.dsp DELETED --- |
From: Roger U. <ru...@us...> - 2008-10-06 00:41:40
|
Update of /cvsroot/pywin32/pywin32/win32/Lib In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv369 Added Files: dbi.py Log Message: Add a dummy dbi module implemented in python --- NEW FILE: dbi.py --- """ Skeleton replacement for removed dbi module. Use of objects created by this module should be replaced with native Python objects. Dates are now returned as datetime.datetime objects, but will still accept PyTime objects also. Raw data for binary fields should be passed as buffer objects for Python 2.x, and memoryview objects in Py3k. """ import warnings warnings.warn( "dbi module is obsolete, code should now use native python datetime and buffer/memoryview objects", DeprecationWarning) import datetime dbDate = dbiDate = datetime.datetime try: dbRaw = dbiRaw = buffer except NameError: dbRaw = dbiRaw = memoryview # type names are still exported by odbc module from odbc import * |
From: Roger U. <ru...@us...> - 2008-10-06 00:40:35
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32483 Modified Files: odbc.cpp Removed Files: dbi.cpp dbi.def dbi.h Log Message: Pick up compatible changes from py3k branch Remove dbi module --- dbi.h DELETED --- --- dbi.cpp DELETED --- --- dbi.def DELETED --- Index: odbc.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/odbc.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** odbc.cpp 29 Jun 2007 16:21:32 -0000 1.20 --- odbc.cpp 6 Oct 2008 00:40:28 -0000 1.21 *************** *** 16,19 **** --- 16,22 ---- #include "PyWinTypes.h" + #include "PyWinObjects.h" + #include "structmember.h" + #include <sql.h> #include <sqlext.h> *************** *** 29,50 **** [...1984 lines suppressed...] }; static int odbcCompare(const void * v1, const void * v2) { ! return _tcscmp(((const odbcErrorDesc *) v1)->state, ((const odbcErrorDesc *) v2)->state); } *************** *** 1990,1994 **** ! static odbcErrorDesc *lookupError(const char *sqlState) { odbcErrorDesc key; --- 2182,2186 ---- ! static odbcErrorDesc *lookupError(const TCHAR *sqlState) { odbcErrorDesc key; |
From: Roger U. <ru...@us...> - 2008-10-05 22:46:28
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv24336 Modified Files: Tag: py3k win32ImageList.cpp Log Message: Prevent annoying "pure virtual function call" popup when closing Pythonwin_d Index: win32ImageList.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32ImageList.cpp,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.2 diff -C2 -d -r1.3.2.1 -r1.3.2.2 *** win32ImageList.cpp 29 Aug 2008 05:53:29 -0000 1.3.2.1 --- win32ImageList.cpp 5 Oct 2008 22:46:24 -0000 1.3.2.2 *************** *** 31,35 **** { CImageList::Dump(dc); ! DumpAssocPyObject(dc, (void *)this); } #endif --- 31,35 ---- { CImageList::Dump(dc); ! // DumpAssocPyObject(dc, (void *)this); } #endif |
From: Roger U. <ru...@us...> - 2008-10-05 19:54:18
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7903 Modified Files: Tag: py3k PyHANDLE.cpp Log Message: Fix printing of PyHANDLE Reenable exception handling for invalid handle in Close Index: PyHANDLE.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyHANDLE.cpp,v retrieving revision 1.16.2.3 retrieving revision 1.16.2.4 diff -C2 -d -r1.16.2.3 -r1.16.2.4 *** PyHANDLE.cpp 1 Oct 2008 13:19:14 -0000 1.16.2.3 --- PyHANDLE.cpp 5 Oct 2008 19:54:04 -0000 1.16.2.4 *************** *** 220,228 **** if (m_handle) { Py_BEGIN_ALLOW_THREADS ! #ifdef Py_DEBUG_xxx __try { #endif // Py_DEBUG rc = CloseHandle(m_handle); ! #ifdef Py_DEBUG_xxx } __except(1) { // according to the docs on CloseHandle(), this --- 220,228 ---- if (m_handle) { Py_BEGIN_ALLOW_THREADS ! #ifdef Py_DEBUG __try { #endif // Py_DEBUG rc = CloseHandle(m_handle); ! #ifdef Py_DEBUG } __except(1) { // according to the docs on CloseHandle(), this *************** *** 344,348 **** { WCHAR resBuf[160]; ! _snwprintf(resBuf, 160, L"<%s:%Id>", GetTypeName(), m_handle); return PyWinCoreString_FromString(resBuf); } --- 344,348 ---- { WCHAR resBuf[160]; ! _snwprintf(resBuf, 160, L"<%hs:%Id>", GetTypeName(), m_handle); return PyWinCoreString_FromString(resBuf); } |
From: Mark H. <mha...@us...> - 2008-10-05 09:19:47
|
Update of /cvsroot/pywin32/pywin32 In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32502 Removed Files: setup_win32all.py Log Message: kill old file. --- setup_win32all.py DELETED --- |
From: Roger U. <ru...@us...> - 2008-10-04 18:40:14
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv8451 Modified Files: Tag: py3k win32uimodule.cpp Log Message: Check return from PyWinGlobals_Ensure More error checking in init function Create copyright string as unicode Index: win32uimodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32uimodule.cpp,v retrieving revision 1.39.2.5 retrieving revision 1.39.2.6 diff -C2 -d -r1.39.2.5 -r1.39.2.6 *** win32uimodule.cpp 4 Oct 2008 17:56:54 -0000 1.39.2.5 --- win32uimodule.cpp 4 Oct 2008 18:40:01 -0000 1.39.2.6 *************** *** 2266,2281 **** RETURN_MODULE; ! PyWinGlobals_Ensure(); #if (PY_VERSION_HEX < 0x03000000) module = Py_InitModule(uiModName, ui_functions); - if (!module) - return; - dict = PyModule_GetDict(module); - if (!dict) - return; - ui_module_error = PyErr_NewException("win32ui.error", NULL, NULL); - if (!ui_module_error) - return; #else --- 2266,2274 ---- RETURN_MODULE; ! if (PyWinGlobals_Ensure() == -1) ! RETURN_ERROR; #if (PY_VERSION_HEX < 0x03000000) module = Py_InitModule(uiModName, ui_functions); #else *************** *** 2288,2307 **** }; module = PyModule_Create(&win32ui_def); if (!module) ! return NULL; dict = PyModule_GetDict(module); if (!dict) ! return NULL; ui_module_error = PyErr_NewException("win32ui.error", NULL, NULL); ! if (!ui_module_error) ! return NULL; ! #endif - PyDict_SetItemString(dict, "error", ui_module_error); - // drop email addy - too many ppl use it for support requests for other - // tools that simply embed Pythonwin... - PyObject *copyright = PyString_FromString("Copyright 1994-2008 Mark Hammond"); - PyDict_SetItemString(dict, "copyright", copyright); - Py_XDECREF(copyright); PyObject *dllhandle = PyWinLong_FromHANDLE(hWin32uiDll); PyDict_SetItemString(dict, "dllhandle", dllhandle); --- 2281,2303 ---- }; module = PyModule_Create(&win32ui_def); + #endif + if (!module) ! RETURN_ERROR; dict = PyModule_GetDict(module); if (!dict) ! RETURN_ERROR; ! ui_module_error = PyErr_NewException("win32ui.error", NULL, NULL); ! if ((ui_module_error == NULL) || PyDict_SetItemString(dict, "error", ui_module_error) == -1) ! RETURN_ERROR; ! ! // drop email addy - too many ppl use it for support requests for other ! // tools that simply embed Pythonwin... ! PyObject *copyright = PyWinCoreString_FromString("Copyright 1994-2008 Mark Hammond"); ! if ((copyright == NULL) || PyDict_SetItemString(dict, "copyright", copyright) == -1) ! RETURN_ERROR; ! Py_XDECREF(copyright); PyObject *dllhandle = PyWinLong_FromHANDLE(hWin32uiDll); PyDict_SetItemString(dict, "dllhandle", dllhandle); |
From: Roger U. <ru...@us...> - 2008-10-04 17:57:05
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5938 Modified Files: Tag: py3k win32uimodule.cpp Log Message: Remove unused AddConstant function Index: win32uimodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32uimodule.cpp,v retrieving revision 1.39.2.4 retrieving revision 1.39.2.5 diff -C2 -d -r1.39.2.4 -r1.39.2.5 *** win32uimodule.cpp 1 Oct 2008 13:50:54 -0000 1.39.2.4 --- win32uimodule.cpp 4 Oct 2008 17:56:54 -0000 1.39.2.5 *************** *** 1960,1977 **** }; - static int AddConstant(PyObject *dict, char *key, long value) - { - PyObject *okey = PyString_FromString(key); - PyObject *oval = PyInt_FromLong(value); - if (!okey || !oval) { - XDODECREF(okey); - XDODECREF(oval); - return 1; - } - int rc = PyDict_SetItem(dict,okey, oval); - DODECREF(okey); - DODECREF(oval); - return rc; - } #define ADD_CONSTANT(tok) if (PyModule_AddIntConstant(module, #tok, tok) == -1) return -1; #define ADD_ENUM(parta, partb) if (PyModule_AddIntConstant(module, #parta "_" #partb, parta::partb) == -1) return -1; --- 1960,1963 ---- |
From: Roger U. <ru...@us...> - 2008-10-04 04:10:29
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv25697 Modified Files: Tag: py3k PyWinTypesmodule.cpp Log Message: Fix version check for builtins, some more error checking Index: PyWinTypesmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypesmodule.cpp,v retrieving revision 1.39.2.5 retrieving revision 1.39.2.6 diff -C2 -d -r1.39.2.5 -r1.39.2.6 *** PyWinTypesmodule.cpp 1 Oct 2008 08:10:11 -0000 1.39.2.5 --- PyWinTypesmodule.cpp 4 Oct 2008 04:10:23 -0000 1.39.2.6 *************** *** 857,886 **** Py_DECREF(name); PyObject *bimod = PyImport_ImportModule( ! #if PY_VERSION_HEX > 0x2030300 "builtins"); #else "__builtin__"); #endif ! if (bimod) { ! PyDict_SetItemString(d, "__builtins__", bimod); ! Py_DECREF(bimod); ! } // Note using 'super()' doesn't work as expected on py23... ! PyRun_String("class error(Exception):\n" ! " def __init__(self, *args, **kw):\n" ! " self.winerror, self.funcname, self.strerror = args[:3]\n" ! " Exception.__init__(self, *args, **kw)\n" ! "class com_error(Exception):\n" ! " def __init__(self, *args, **kw):\n" ! " self.hresult = args[0]\n" ! " if len(args)>1: self.strerror = args[1]\n" ! " else: self.strerror = None\n" ! " if len(args)>2: self.excepinfo = args[2]\n" ! " else: self.excepinfo = None\n" ! " if len(args)>3: self.argerror = args[3]\n" ! " else: self.argerror = None\n" ! " Exception.__init__(self, *args, **kw)\n" ! , ! Py_file_input, d, d); PyWinExc_ApiError = PyDict_GetItemString(d, "error"); Py_XINCREF(PyWinExc_ApiError); --- 857,894 ---- Py_DECREF(name); PyObject *bimod = PyImport_ImportModule( ! #if PY_VERSION_HEX >= 0x03000000 "builtins"); #else "__builtin__"); #endif ! if ((bimod == NULL) ! ||PyDict_SetItemString(d, "__builtins__", bimod) == -1){ ! Py_XDECREF(bimod); ! return -1; ! } ! Py_DECREF(bimod); ! // Note using 'super()' doesn't work as expected on py23... ! PyObject *res=PyRun_String( ! "class error(Exception):\n" ! " def __init__(self, *args, **kw):\n" ! " self.winerror, self.funcname, self.strerror = args[:3]\n" ! " Exception.__init__(self, *args, **kw)\n" ! "class com_error(Exception):\n" ! " def __init__(self, *args, **kw):\n" ! " self.hresult = args[0]\n" ! " if len(args)>1: self.strerror = args[1]\n" ! " else: self.strerror = None\n" ! " if len(args)>2: self.excepinfo = args[2]\n" ! " else: self.excepinfo = None\n" ! " if len(args)>3: self.argerror = args[3]\n" ! " else: self.argerror = None\n" ! " Exception.__init__(self, *args, **kw)\n" ! , ! Py_file_input, d, d); ! if (res==NULL) ! return -1; ! Py_DECREF(res); ! PyWinExc_ApiError = PyDict_GetItemString(d, "error"); Py_XINCREF(PyWinExc_ApiError); |
From: Roger U. <ru...@us...> - 2008-10-04 03:16:32
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21832 Modified Files: test_sspi.py Log Message: Update exception handling Index: test_sspi.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/test_sspi.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_sspi.py 13 Feb 2006 14:49:31 -0000 1.3 --- test_sspi.py 4 Oct 2008 03:16:24 -0000 1.4 *************** *** 10,16 **** try: return func(*args) ! raise RuntimeError, "expecting %s failure" % (hr,) ! except win32security.error, (hr_got, func, msg): ! self.failUnlessEqual(hr_got, hr) def _doAuth(self, pkg_name): --- 10,16 ---- try: return func(*args) ! raise RuntimeError("expecting %s failure" % (hr,)) ! except win32security.error, exc: ! self.failUnlessEqual(exc.winerror, hr) def _doAuth(self, pkg_name): |
From: Roger U. <ru...@us...> - 2008-10-04 00:30:21
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10593 Modified Files: Tag: py3k win32event.i Log Message: Incorporate fix for MsgWaitForMultipleObjectsEx from main branch Index: win32event.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32event.i,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -C2 -d -r1.9.2.1 -r1.9.2.2 *** win32event.i 29 Aug 2008 04:59:26 -0000 1.9.2.1 --- win32event.i 4 Oct 2008 00:30:04 -0000 1.9.2.2 *************** *** 219,223 **** %name(MsgWaitForMultipleObjectsEx) PyObject *MyMsgWaitForMultipleObjectsEx( PyObject *obHandleList, // @pyparm [<o PyHANDLE>, ...]|handleList||A sequence of handles to wait on. - BOOL fWaitAll, // @pyparm int|fWaitAll||wait for all or wait for one DWORD dwMilliseconds, // @pyparm int|milliseconds||time-out interval in milliseconds DWORD dwWakeMask, // @pyparm int|wakeMask||type of input events to wait for --- 219,222 ---- *************** *** 228,232 **** static PyObject * MyMsgWaitForMultipleObjectsEx( PyObject *handleList, - BOOL fWaitAll, // wait for all or wait for one DWORD dwMilliseconds, // time-out interval in milliseconds DWORD dwWakeMask, --- 227,230 ---- *************** *** 240,256 **** DWORD rc; ! // Do a LoadLibrary, as the Ex version does not exist on NT3.x, Win95 ! // @comm This method does not exist on NT3.5x or Win95. If there ! // is an attempt to use it on these platforms, a COM error with ! // E_NOTIMPL will be raised. ! HMODULE hMod = GetModuleHandle(_T("user32.dll")); ! if (hMod==0) return PyWin_SetBasicCOMError(E_HANDLE); ! FARPROC fp = GetProcAddress(hMod, "MsgWaitForMultipleObjectsEx"); ! if (fp==NULL) return PyWin_SetBasicCOMError(E_NOTIMPL); ! ! DWORD (*mypfn)(DWORD, LPHANDLE, DWORD, DWORD, DWORD); ! mypfn = (DWORD (*)(DWORD, LPHANDLE, DWORD, DWORD, DWORD))fp; Py_BEGIN_ALLOW_THREADS ! rc = (*mypfn)(numItems, pItems, dwMilliseconds, dwWakeMask, dwFlags); Py_END_ALLOW_THREADS PyObject *obrc; --- 238,245 ---- DWORD rc; ! // @comm This method will no longer raise a COM E_NOTIMPL exception ! // as it is no longer dynamically loaded. Py_BEGIN_ALLOW_THREADS ! rc = MsgWaitForMultipleObjectsEx(numItems, pItems, dwMilliseconds, dwWakeMask, dwFlags); Py_END_ALLOW_THREADS PyObject *obrc; *************** *** 264,268 **** %} - // @pyswig <o PyHANDLE>|OpenEvent|Returns a handle of an existing named event object. PyHANDLE OpenEvent( --- 253,256 ---- |
From: Roger U. <ru...@us...> - 2008-10-03 22:44:43
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30559 Modified Files: Tag: py3k test_sspi.py Log Message: Too enthusiatic with the 'b''s Index: test_sspi.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/test_sspi.py,v retrieving revision 1.3.4.1 retrieving revision 1.3.4.2 diff -C2 -d -r1.3.4.1 -r1.3.4.2 *** test_sspi.py 3 Oct 2008 22:41:20 -0000 1.3.4.1 --- test_sspi.py 3 Oct 2008 22:44:37 -0000 1.3.4.2 *************** *** 103,107 **** def testSequenceSign(self): # Only Kerberos supports sequence detection. ! sspiclient, sspiserver = self._doAuth(b"Kerberos") key = sspiclient.sign(b"hello") sspiclient.sign(b"hello") --- 103,107 ---- def testSequenceSign(self): # Only Kerberos supports sequence detection. ! sspiclient, sspiserver = self._doAuth("Kerberos") key = sspiclient.sign(b"hello") sspiclient.sign(b"hello") |
From: Roger U. <ru...@us...> - 2008-10-03 22:41:27
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30291 Modified Files: Tag: py3k test_sspi.py Log Message: Pass test data as bytes, use winerror exception attribute Index: test_sspi.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/test_sspi.py,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -d -r1.3 -r1.3.4.1 *** test_sspi.py 13 Feb 2006 14:49:31 -0000 1.3 --- test_sspi.py 3 Oct 2008 22:41:20 -0000 1.3.4.1 *************** *** 10,16 **** try: return func(*args) ! raise RuntimeError, "expecting %s failure" % (hr,) ! except win32security.error, (hr_got, func, msg): ! self.failUnlessEqual(hr_got, hr) def _doAuth(self, pkg_name): --- 10,16 ---- try: return func(*args) ! raise RuntimeError("expecting %s failure" % (hr,)) ! except win32security.error as exc: ! self.failUnlessEqual(exc.winerror, hr) def _doAuth(self, pkg_name): *************** *** 42,46 **** pkg_size_info=sspiclient.ctxt.QueryContextAttributes(sspicon.SECPKG_ATTR_SIZES) ! msg='some data to be encrypted ......' trailersize=pkg_size_info['SecurityTrailer'] --- 42,46 ---- pkg_size_info=sspiclient.ctxt.QueryContextAttributes(sspicon.SECPKG_ATTR_SIZES) ! msg=b'some data to be encrypted ......' trailersize=pkg_size_info['SecurityTrailer'] *************** *** 53,61 **** self.failUnlessEqual(msg, encbuf[0].Buffer) # and test the higher-level functions ! data, sig = sspiclient.encrypt("hello") ! self.assertEqual(sspiserver.decrypt(data, sig), "hello") ! data, sig = sspiserver.encrypt("hello") ! self.assertEqual(sspiclient.decrypt(data, sig), "hello") def testEncryptNTLM(self): --- 53,61 ---- self.failUnlessEqual(msg, encbuf[0].Buffer) # and test the higher-level functions ! data, sig = sspiclient.encrypt(b"hello") ! self.assertEqual(sspiserver.decrypt(data, sig), b"hello") ! data, sig = sspiserver.encrypt(b"hello") ! self.assertEqual(sspiclient.decrypt(data, sig), b"hello") def testEncryptNTLM(self): *************** *** 70,74 **** pkg_size_info=sspiclient.ctxt.QueryContextAttributes(sspicon.SECPKG_ATTR_SIZES) ! msg='some data to be encrypted ......' sigsize=pkg_size_info['MaxSignature'] --- 70,74 ---- pkg_size_info=sspiclient.ctxt.QueryContextAttributes(sspicon.SECPKG_ATTR_SIZES) ! msg=b'some data to be encrypted ......' sigsize=pkg_size_info['MaxSignature'] *************** *** 82,97 **** sspiclient.next_seq_num = 1 sspiserver.next_seq_num = 1 ! key = sspiclient.sign("hello") ! sspiserver.verify("hello", key) ! key = sspiclient.sign("hello") self.assertRaisesHRESULT(sspicon.SEC_E_MESSAGE_ALTERED, ! sspiserver.verify, "hellox", key) # and the other way ! key = sspiserver.sign("hello") ! sspiclient.verify("hello", key) ! key = sspiserver.sign("hello") self.assertRaisesHRESULT(sspicon.SEC_E_MESSAGE_ALTERED, ! sspiclient.verify, "hellox", key) def testSignNTLM(self): --- 82,97 ---- sspiclient.next_seq_num = 1 sspiserver.next_seq_num = 1 ! key = sspiclient.sign(b"hello") ! sspiserver.verify(b"hello", key) ! key = sspiclient.sign(b"hello") self.assertRaisesHRESULT(sspicon.SEC_E_MESSAGE_ALTERED, ! sspiserver.verify, b"hellox", key) # and the other way ! key = sspiserver.sign(b"hello") ! sspiclient.verify(b"hello", key) ! key = sspiserver.sign(b"hello") self.assertRaisesHRESULT(sspicon.SEC_E_MESSAGE_ALTERED, ! sspiclient.verify, b"hellox", key) def testSignNTLM(self): *************** *** 103,117 **** def testSequenceSign(self): # Only Kerberos supports sequence detection. ! sspiclient, sspiserver = self._doAuth("Kerberos") ! key = sspiclient.sign("hello") ! sspiclient.sign("hello") self.assertRaisesHRESULT(sspicon.SEC_E_OUT_OF_SEQUENCE, ! sspiserver.verify, 'hello', key) def testSequenceEncrypt(self): # Only Kerberos supports sequence detection. sspiclient, sspiserver = self._doAuth("Kerberos") ! blob, key = sspiclient.encrypt("hello",) ! blob, key = sspiclient.encrypt("hello") self.assertRaisesHRESULT(sspicon.SEC_E_OUT_OF_SEQUENCE, sspiserver.decrypt, blob, key) --- 103,117 ---- def testSequenceSign(self): # Only Kerberos supports sequence detection. ! sspiclient, sspiserver = self._doAuth(b"Kerberos") ! key = sspiclient.sign(b"hello") ! sspiclient.sign(b"hello") self.assertRaisesHRESULT(sspicon.SEC_E_OUT_OF_SEQUENCE, ! sspiserver.verify, b'hello', key) def testSequenceEncrypt(self): # Only Kerberos supports sequence detection. sspiclient, sspiserver = self._doAuth("Kerberos") ! blob, key = sspiclient.encrypt(b"hello",) ! blob, key = sspiclient.encrypt(b"hello") self.assertRaisesHRESULT(sspicon.SEC_E_OUT_OF_SEQUENCE, sspiserver.decrypt, blob, key) |