Lovely Spam! Wonderful Spam!
Project description
pyoverlapped
Async wrapper for Windows Overlapped API
Allows you to wrap ctypes functions that use Windows Overlapped IO into Python coroutines.
Requires no external dependencies. Minimal Python version is 3.8
Installation
pip install pyoverlapped
Usage
For example, we have ctypes-binded function WinDivertRecvEx that supports Overlapepd IO.
To wrap it into coroutine with pyoverlapped, we need 3 things:
- Handle to object on which we perform overlapped operation
- Pointer to a variable that will hold number of transferred bytes
- Function that accepts Overlapped structure as the only argument.
Basically, it wraps our target function
WinDivertRecvEx
With these we can finally await on our function:
from pyoverlapped import perform_overlapped_operation
recv_len = c_uint(0)
f = lambda lpovl: WinDivertRecvEx(..., lpovl)
await perform_overlapped_operation(handle, byref(recv_len), f)
Thanks
Thanks to ffalcinelli for error-handling decorator for ctypes-bound functions
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyoverlapped-1.0.tar.gz.
File metadata
- Download URL: pyoverlapped-1.0.tar.gz
- Upload date:
- Size: 40.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ddad6c4c45fb665b5bacfa040f6a1dfd6203b1eefcc41c5481608564434ca5f
|
|
| MD5 |
9c526fa6858f68acc5e3440e331d8700
|
|
| BLAKE2b-256 |
5aeac89e2da124da6f9f4fb977e0a38d5828e316dae8446e1128bdb322686ee0
|
File details
Details for the file pyoverlapped-1.0-py3-none-any.whl.
File metadata
- Download URL: pyoverlapped-1.0-py3-none-any.whl
- Upload date:
- Size: 30.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc28f76caa59eb5221a7aa1d0dfdc8c6c446f9d6cd10fc84fbe3c074aea2b75c
|
|
| MD5 |
e98d704319a0e4121371a86f9431b0a9
|
|
| BLAKE2b-256 |
2113716028014bdca6685f09f834379562ad666074d0e2292a77881971edbab3
|