Implementation of `select.poll` on Microsoft Windows.
Project description
Implementation of select.poll on Microsoft Windows.
- Pure Python; no C extensions (uses
ctypes.windll) - Drop-in-compatible API
- Clean "ponyfill"; no monkeypatching
- No dependencies (besides Windows Vista or newer)
- Python 3.6+ compatible
Usage
try:
from select import POLLIN, POLLOUT, poll
except ImportError:
# https://github.com/python/cpython/issues/60711
from winpoll import POLLIN, POLLOUT, wsapoll as poll
p = poll()
p.register(sock1, POLLIN)
p.register(sock2, POLLIN | POLLOUT)
p.unregister(sock1)
for sock, events in p.poll(timeout=3):
print(f"Socket {sock} is ready with {events}")
# like select.poll objects, winpoll.wsapoll objects acquire no resources
# thus have no cleanup requirement besides plain garbage collection
Limitations / Bugs
-
Does not work before Windows Vista.
- Last affected OS EOL: April 8, 2014
-
Outbound TCP connections don't correctly report failure-to-connect (
(POLLHUP | POLLERR | POLLWRNORM)) before Windows 10 Version 2004 (OS build 19041).- Last affected OS EOL: May 10, 2022
Installation
Command-line
pip install "winpoll ; sys_platform == 'win32'"
requirements.txt
winpoll ; sys_platform == 'win32'
pyproject.toml
[project]
dependencies = [
...,
"winpoll ; sys_platform == 'win32'",
]
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
winpoll-0.20287.3.tar.gz
(8.6 kB
view details)
File details
Details for the file winpoll-0.20287.3.tar.gz.
File metadata
- Download URL: winpoll-0.20287.3.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ad46c87d804f9001d964ba24997523a9bf2c5a50e3355550248b8021f23b801
|
|
| MD5 |
c2daac624fff9e8b1e8ffcc0132dc41f
|
|
| BLAKE2b-256 |
2987245df2a90608e5471054b0be75521d481259f6a927ebed9c6de61b97caaf
|