Repository navigation
Conversation
|
Lets ensure the other stuff works before I make tests for windows. |
|
3.9 ubuntu is broken but we are ignoring that it's a workflow issue not a uvloop issue. |
|
import signal
import sys
def handler(signum, frame):
if signum == signal.SIGUSR1:
print('WORLD')
if sys.platform != 'win32':
signal.signal(signal.SIGUSR1, handler)
a = input()
print(a)
a = input()
print(a)
exit(11)
This is fixed now |
|
Vizonex/Winloop#194 Posting this here since it relates, it's a problem that has been preventing me from moving forward. |
|
Problem solved for subprocesses an PR is incoming from my end. |
…16) * fix subprocess problems and enable more tests to start running again * fix linting * mark linux tests as non-reproducible * reformat tests
|
1 test needs solving (unrelated) but this PR appears to be ready for merge. @fantix I'll let this merge be your call but windows support is considered done. My work here is done and I'm proud of what me and my team has accomplished. |
|
I'm planning to turn off the win fork for workflows when the PR is approved by a reviewer since I was having to do a lot of on/off with workflows to ensure everything worked correctly. |
* Apply final changes before merging windows support with uvloop * disable linux on test_process_delayed_stdio__not_paused__no_stdin * remove win branch from tests.yml as local testing is complete
|
It's ready now. |
There was a problem hiding this comment.
🟡 Changes recommended
Critical Windows defects remain, including a Win64 stack overwrite, incorrect signal registration, and source-distribution builds that fail without Unix tooling.
13 open issues
Avoid Unix autotools when building source distributions on Windows · New Use native-width storage for Windows handles · New Register the requested signal on Windows · New Restrict the call_later skip to Windows · New Move accepted-socket test orchestration out of nested function · New Restore subprocess protocol context propagation coverage · New Use a SelectorEventLoop in the Windows test workaround · New Check stderr validity in the stderr fallback · New Make Windows socketpair pipe ends directional · New Preserve negative uv_pipe errors during conversion · New Drop late writes after close without raising · New Use interlocked operations for handle counters · New Preserve Windows command quoting when launching subprocesses · New
What changed in this PR
This PR extends uvloop’s libuv-backed asyncio implementation with native Windows build and runtime paths, addressing the long-standing Windows support requests.
Changes:
- Adds Windows compilation of bundled libuv and removes the installation restriction.
- Introduces Windows-specific subprocess, stream, polling, signal, DNS, and error handling.
- Adds Windows CI jobs and adapts platform-dependent tests.
| File | Description |
|---|---|
uvloop/server.pyx |
Uses the cached asyncio cancellation exception. |
uvloop/loop.pyx |
Adds Windows subprocess, socket, and signal paths. |
uvloop/loop.pyi |
Modernizes type annotation syntax. |
uvloop/includes/uv.pxd |
Adds libuv pipe and Windows process declarations. |
uvloop/includes/system.pxd |
Adds Windows compatibility declarations and counter helpers. |
uvloop/includes/stdlib.pxi |
Caches Windows-related constants and standard-library helpers. |
uvloop/includes/python.pxd |
Adds a comment-only frame-helper TODO. |
uvloop/includes/fork_handler.h |
Guards pthread use and adds a Windows stub. |
uvloop/includes/compat.h |
Adds Windows wrappers, platform flags, and stdio checks. |
uvloop/handles/stream.pyx |
Adapts stream writes and pipe reads for Windows. |
uvloop/handles/process.pyx |
Adds Windows startup information and pipe-based subprocess stdio. |
uvloop/handles/process.pxd |
Updates subprocess signatures for startup information. |
uvloop/handles/poll.pyx |
Switches to socket-aware polling initialization. |
uvloop/handles/fsevent.pyx |
Removes an extra blank line. |
uvloop/errors.pyx |
Adds Windows error-code and DNS-message handling. |
uvloop/dns.pyx |
Adds Windows address-conversion and hostname handling. |
uvloop/_testbase.py |
Adds Windows detection and platform-aware test setup. |
tests/test_unix.py |
Skips Unix socket tests on Windows and reformats code. |
tests/test_udp.py |
Adds Windows skips and loop-policy selection. |
tests/test_testbase.py |
Reformats existing test-helper assertions. |
tests/test_sourcecode.py |
Simplifies subprocess output capture and formatting. |
tests/test_sockets.py |
Adds Windows-specific skips and loop-policy selection. |
tests/test_signals.py |
Adapts signal expectations and skips for Windows. |
tests/test_runner.py |
Reformats existing runner tests. |
tests/test_regr1.py |
Reformats multiprocessing regression tests. |
tests/test_process_spawning.py |
Selects Windows C-runtime process functions. |
tests/test_pipes.py |
Skips unsupported Windows pipe and terminal cases. |
tests/test_libuv_api.py |
Reorders imports only. |
tests/test_fs_event.py |
Adds a Windows file-change test skip. |
tests/test_executors.py |
Simplifies iteration and reformats existing tests. |
tests/test_dns.py |
Adds Windows skips for address-result comparisons. |
tests/test_dealloc.py |
Reformats subprocess calls and assertions. |
tests/test_cython.py |
Simplifies coroutine-name assertions and reorders imports. |
tests/test_context.py |
Adapts transport context tests for Windows. |
tests/test_base.py |
Guards fcntl use and adjusts timer-test skips. |
tests/test_aiohttp.py |
Adds Windows loop-policy selection and simplifies client code. |
tests/__main__.py |
Enables multiprocessing freeze support on Windows. |
setup.py |
Adds Windows compiler settings, libraries, and libuv sources. |
pyproject.toml |
Comments out license classifiers. |
.github/workflows/tests.yml |
Adds Windows jobs and adjusts matrix/debug-build coverage. |
Review effort: Max
| if sys.platform != 'win32': | ||
| # Make sure configure and friends are present in case | ||
| # we are building from a git checkout. | ||
| _libuv_autogen(env) |
| # be an option, but the corresponding files have been created | ||
| # FILE_FLAG_OVERLAPPED set, but we don't want to go that way here. | ||
| # We detect pipes on Windows as pseudosockets. | ||
| if self._get_socket().family == uv.AF_UNIX: |
There was a problem hiding this comment.
@fantix I'm working on a fix for it. Bit sizes have always been a problem. I have opened another PR on my end for applying many of these fixes. Vizonex#18
There was a problem hiding this comment.
@fantix I finished resolving it. Cython code should now return uv_os_fd_t as inteneded without any size reductions.
static uv_os_fd_t __pyx_f_6uvloop_4loop_14UVSocketHandle__fileno(struct __pyx_obj_6uvloop_4loop_UVSocketHandle *__pyx_v_self) {
uv_os_fd_t __pyx_v_fd;
int __pyx_v_err;
uv_os_fd_t __pyx_r;
__Pyx_RefNannyDeclarations
PyObject *__pyx_t_1 = NULL;
int __pyx_t_2;
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("_fileno", 0);
/* "uvloop/handles/handle.pyx":232
* int err
*
* self._ensure_alive() # <<<<<<<<<<<<<<
* err = uv.uv_fileno(self._handle, &fd)
* if err < 0:
*/
__pyx_t_1 = ((struct __pyx_vtabstruct_6uvloop_4loop_UVSocketHandle *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._ensure_alive(((struct __pyx_obj_6uvloop_4loop_UVHandle *)__pyx_v_self)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 232, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
/* "uvloop/handles/handle.pyx":233
*
* self._ensure_alive()
* err = uv.uv_fileno(self._handle, &fd) # <<<<<<<<<<<<<<
* if err < 0:
* raise convert_error(err)
*/
__pyx_v_err = uv_fileno(__pyx_v_self->__pyx_base._handle, (&__pyx_v_fd));
/* "uvloop/handles/handle.pyx":234
* self._ensure_alive()
* err = uv.uv_fileno(self._handle, &fd)
* if err < 0: # <<<<<<<<<<<<<<
* raise convert_error(err)
*
*/
__pyx_t_2 = (__pyx_v_err < 0);
if (unlikely(__pyx_t_2)) {
/* "uvloop/handles/handle.pyx":235
* err = uv.uv_fileno(self._handle, &fd)
* if err < 0:
* raise convert_error(err) # <<<<<<<<<<<<<<
*
* return fd
*/
__pyx_t_1 = __pyx_f_6uvloop_4loop_convert_error(__pyx_v_err); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 235, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__Pyx_Raise(__pyx_t_1, 0, 0, 0);
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
__PYX_ERR(1, 235, __pyx_L1_error)
/* "uvloop/handles/handle.pyx":234
* self._ensure_alive()
* err = uv.uv_fileno(self._handle, &fd)
* if err < 0: # <<<<<<<<<<<<<<
* raise convert_error(err)
*
*/
}
/* "uvloop/handles/handle.pyx":237
* raise convert_error(err)
*
* return fd # <<<<<<<<<<<<<<
*
* cdef _new_socket(self):
*/
{
__pyx_r = __pyx_v_fd;
}
goto __pyx_L0;
/* "uvloop/handles/handle.pyx":227
* self.__cached_socket = None
*
* cdef uv.uv_os_fd_t _fileno(self): # <<<<<<<<<<<<<<
* cdef:
* uv.uv_os_fd_t fd
*/
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("uvloop.loop.UVSocketHandle._fileno", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}| self.assertGreater(finished - started, 0.04) | ||
|
|
||
| @unittest.skipIf( | ||
| sys.version_info[:2] <= (3, 12), |
| # Originally it was removed but brought back. | ||
| # SEE: https://github.com/Vizonex/Winloop/issues/153 | ||
|
|
||
| args.extend(split_windows_shell_command(cmd)) |
… on Windows' Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* fix more code based on copilot's suggestions * isolate _libuv_autogen away from windows * resize variables in the compat write function and in uv_fileno * add _conn_lost counter instead of rasing a runtime error * ensure posix is set to false * escape backslashes before splitting shell code into tokens * throw error if uv_pipe fails while using __socketpair()
…more notes than winloop had about it.


This is a redo of my older Pull Request from earlier this year. I want to still thank everybody for staying hyped and keeping me involved.
Let us finish what @1st1 started 10 years ago. My plans after this is merged is to start bringing as many optimizations from winloop to this library as I can, after that
winloopwill begin starting it's deprecation process until eventually it just installsuvloopas a dependency and then thewinlooprepo will be archived.closes #14
closes #536
closes #652
closes #62