◐ Shell
clean mode source ↗

Fix Overlapped I/O by boxing OVERLAPPED struct and accept overlapped arg positionally by youknowone · Pull Request #7198 · RustPython/RustPython

…arg positionally

Two fixes in _winapi:

1. Box the OVERLAPPED struct in OverlappedInner to ensure it stays at
   a stable heap address. Previously, into_pyobject() moved the struct
   after ReadFile/WriteFile had given the OS a pointer to it, causing
   GetOverlappedResult to read stale data (returning err=0 instead of
   ERROR_MORE_DATA for zero-byte reads on message pipes).

2. Change ReadFile, WriteFile, ConnectNamedPipe overlapped parameter
   from #[pyarg(named)] to #[pyarg(any)] so it can be passed both
   positionally and as keyword argument.

@youknowone marked this pull request as ready for review

February 22, 2026 13:05

youknowone added a commit to youknowone/RustPython that referenced this pull request

Mar 22, 2026
…arg positionally (RustPython#7198)

Two fixes in _winapi:

1. Box the OVERLAPPED struct in OverlappedInner to ensure it stays at
   a stable heap address. Previously, into_pyobject() moved the struct
   after ReadFile/WriteFile had given the OS a pointer to it, causing
   GetOverlappedResult to read stale data (returning err=0 instead of
   ERROR_MORE_DATA for zero-byte reads on message pipes).

2. Change ReadFile, WriteFile, ConnectNamedPipe overlapped parameter
   from #[pyarg(named)] to #[pyarg(any)] so it can be passed both
   positionally and as keyword argument.