[pywin32-checkins] pywin32/win32/src win32pipe.i,1.13,1.14
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2006-07-16 11:02:34
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18175/src Modified Files: win32pipe.i Log Message: Fix the return value from win32pipe.ConnectNamedPipe() when the function succeeds, as discussed on python-win32. Index: win32pipe.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32pipe.i,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** win32pipe.i 10 Jan 2006 00:21:28 -0000 1.13 --- win32pipe.i 16 Jul 2006 11:02:23 -0000 1.14 *************** *** 259,264 **** // @pyswig int|ConnectNamedPipe|Connects to a named pipe ! // @comm The result is the HRESULT from the underlying function. ! // If an overlapped object is passed, the result may be ERROR_IO_PENDING or ERROR_PIPE_CONNECTED. PyObject *MyConnectNamedPipe(PyObject *self, PyObject *args) { --- 259,267 ---- // @pyswig int|ConnectNamedPipe|Connects to a named pipe ! // @comm The result is zero if the function succeeds. If the function fails, ! // GetLastError() is called, and if the result is ERROR_IO_PENDING or ERROR_PIPE_CONNECTED ! // (common when passing an overlapped object), this value is returned. All ! // other error values raise a win32 exception (from which the error code ! // can be extracted) PyObject *MyConnectNamedPipe(PyObject *self, PyObject *args) { *************** *** 280,290 **** } BOOL ok; ! Py_BEGIN_ALLOW_THREADS ok = ConnectNamedPipe(hNamedPipe, pOverlapped); ! Py_END_ALLOW_THREADS ! DWORD rc = GetLastError(); // These error conditions are documented as "acceptable" - ie, // the function has still worked. ! if (!ok && rc!= 0 && rc != ERROR_IO_PENDING && rc != ERROR_PIPE_CONNECTED) return PyWin_SetAPIError("ConnectNamedPipe"); return PyInt_FromLong(rc); --- 283,293 ---- } BOOL ok; ! Py_BEGIN_ALLOW_THREADS ok = ConnectNamedPipe(hNamedPipe, pOverlapped); ! Py_END_ALLOW_THREADS ! DWORD rc = ok ? 0 : GetLastError(); // These error conditions are documented as "acceptable" - ie, // the function has still worked. ! if (!ok && rc != ERROR_IO_PENDING && rc != ERROR_PIPE_CONNECTED) return PyWin_SetAPIError("ConnectNamedPipe"); return PyInt_FromLong(rc); |