I also think that using ctypes instead of pypiwin32 would be a good idea.
In this way we remove all the confusion caused by the implementation of wrappers
from pypiwin32 and remove the dependency on the pypiwin32 module.

Example for WaitForMultipleObjects where the wrapper from pypiwin32 raises
an exception if the function returns WAIT_FAILED and returns the error code 
otherwise:
https://github.com/pywin32/pypiwin32/blob/master/win32/src/win32event.i#L340-L343

For ReadFile, if we pass an overlapped structure and the ReadFile finished 
syncronously
we will have to make an extra call to GetOverlappedResult to get the read 
number of bytes.
This is due to the fact that the number of bytes read is not returned by the 
wrapper implementation
from pypiwin32 and the buffer is not resized if an overlapped structure is 
passed.
The implementation can be viewed here:
https://github.com/pywin32/pypiwin32/blob/master/win32/src/win32file.i#L896-L987


> -----Original Message-----
> From: [email protected] [mailto:[email protected]]
> Sent: Wednesday, August 23, 2017 12:05 PM
> To: 'Russell Bryant' <[email protected]>; Alin Balutoiu
> <[email protected]>
> Cc: [email protected]
> Subject: RE: [ovs-dev] [PATCH] windows, python: Fix event type returned
> from poller
> 
> Does it make sense to use python ctypes instead of pypiwin32?
> 
> It seems better to make our own calls instead of using wrappers which treat
> just certain cases.
> 
> Acked-by: Alin Gabriel Serdean <[email protected]>
> 
> > -----Original Message-----
> > From: [email protected] [mailto:ovs-dev-
> > [email protected]] On Behalf Of Russell Bryant
> > Sent: Tuesday, August 22, 2017 6:34 PM
> > To: Alin Balutoiu <[email protected]>
> > Cc: [email protected]
> > Subject: Re: [ovs-dev] [PATCH] windows, python: Fix event type
> > returned from poller
> >
> > Ah, that makes sense for the Python version.
> >
> > The Python docs were sparse, so I wasn't sure.
> >
> > On Tue, Aug 22, 2017 at 8:35 AM, Alin Balutoiu
> > <[email protected]> wrote:
> > > Looking at the implementation of WaitForMultipleObjects in Python it
> > > looks that the call will raise an exception if WAIT_FAILED is
> > > returned. This case is treated by the try/except block around the
> > WaitForMultipleObjects function.
> > >
> > > Thanks,
> > > Alin Balutoiu.
> > >

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to