Skip to main content

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:

  1. Handle to object on which we perform overlapped operation
  2. Pointer to a variable that will hold number of transferred bytes
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyoverlapped-1.0.1.tar.gz (40.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyoverlapped-1.0.1-py3-none-any.whl (30.1 kB view details)

Uploaded Python 3

File details

Details for the file pyoverlapped-1.0.1.tar.gz.

File metadata

  • Download URL: pyoverlapped-1.0.1.tar.gz
  • Upload date:
  • Size: 40.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyoverlapped-1.0.1.tar.gz
Algorithm Hash digest
SHA256 cbe3b47f1cd8c0f6c836b691fa3c4933a3b7d710b64e607acbf59c0883ea8980
MD5 e5069abdeb38f941e58cbcd789facaee
BLAKE2b-256 64667d74a500dc9ee8b08c51dac13fa00362556adee8d59b60c1ca55f5992397

See more details on using hashes here.

File details

Details for the file pyoverlapped-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyoverlapped-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 30.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyoverlapped-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f3f5471f7fc56f1c965693429bc1bcac351ffc55fb128b3e9185cc72f4255da3
MD5 b03dc097a8064ad8e58b64e40c4d38de
BLAKE2b-256 73bf4efe19e464e00fd676da38ac06adea7790e6c5f74bc60edafc5bce883b42

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page