Author: andrewjlawrence
Branch: winoverlapped
Changeset: r96355:9042d6247856
Date: 2019-03-27 07:26 +0000
http://bitbucket.org/pypy/pypy/changeset/9042d6247856/

Log:    Fixed a few more bugs realted to overlapped io in test_events.py

diff --git a/lib_pypy/_overlapped.py b/lib_pypy/_overlapped.py
--- a/lib_pypy/_overlapped.py
+++ b/lib_pypy/_overlapped.py
@@ -206,7 +206,7 @@
             self.error = err
 
         if err != _winapi.ERROR_SUCCESS and err != _winapi.ERROR_MORE_DATA:
-            if not (err == _winapi.ERROR_BROKEN_PIPE and (self.type == 
TYPE_READ or self.type == TYPE_READINTO)):
+            if not (err == _winapi.ERROR_BROKEN_PIPE and (self.type in 
[OverlappedType.TYPE_READ, OverlappedType.TYPE_READINTO])):
                 raise _winapi._WinError()
 
         if self.type == OverlappedType.TYPE_READ:
@@ -502,8 +502,6 @@
     pdata = _ffi.cast("PostCallbackData *", lpparameter)
     ret = _kernel32.PostQueuedCompletionStatus(pdata.hCompletionPort, 
timerorwaitfired, _ffi.cast("ULONG_PTR",0), pdata.Overlapped)
     result = False
-#    if not ret:
-#         err = _winapi._WinError()
 
 
 def RegisterWaitWithQueue(object, completionport, ovaddress, miliseconds):
@@ -512,7 +510,7 @@
     data[0].hCompletionPort = completionport
     data[0].Overlapped = ovaddress
     ret = _kernel32.RegisterWaitForSingleObject(newwaitobject,
-                                                object,
+                                                _int2handle(object),
                                                 
_ffi.cast("WAITORTIMERCALLBACK",post_to_queue_callback),
                                                 data,
                                                 miliseconds, 
diff --git a/lib_pypy/_winapi.py b/lib_pypy/_winapi.py
--- a/lib_pypy/_winapi.py
+++ b/lib_pypy/_winapi.py
@@ -52,7 +52,7 @@
     handle = _kernel32.CreateFileW(*args)
     if handle == INVALID_HANDLE_VALUE:
         raise _WinError()
-    return handle
+    return _handle2int(handle)
 
 def SetNamedPipeHandleState(namedpipe, mode, max_collection_count, 
collect_data_timeout):
     d0 = _ffi.new('DWORD[1]', [mode])
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to