You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PyTCP documents SO_RCVTIMEO / SO_SNDTIMEO as "float seconds", but
setsockopt gated the SOL_SOCKET dispatch on isinstance(value, int)
so a sub-second float was rejected with ENOPROTOOPT, and
getsockopt int()-truncated the stored timeout to whole seconds. A
persistent sub-second timeout was therefore unsettable via the
public API — including the R3 blocking-send SO_SNDTIMEO.
Widen the setsockopt 'value' to int | float | bytes across the
four concrete socket classes and route a float FIRST: a float is
only valid for the SOL_SOCKET float-seconds timeouts, so it goes
straight to _sol_socket_setsockopt (which already does
float(value)) and the int / bytes option handlers below never
receive one (keeping their signatures unchanged). getsockopt now
returns the stored float verbatim (int | float | bytes) instead
of truncating.
Tests-first: TestUdpSocketTimeoutFloat — SO_RCVTIMEO=0.5 /
SO_SNDTIMEO=0.25 round-trip through getsockopt, and an integer
value is still accepted (regression). Verified red (ENOPROTOOPT)
before the widening.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments