Skip to content

add_signal_handler should raise NotImplementedError on Windows #85

Open
@pquentin

Description

@pquentin

uvicorn relies on this behavior: https://github.com/encode/uvicorn/blob/77468df/uvicorn/main.py#L568-L577. Running the code in #84 results in the following traceback on Windows:

{PATH}trio_asyncio\_base.py:20: TrioDeprecationWarning: trio.hazmat is deprecated since Trio 0.15.0; use trio.lowlevel instead (https://github.com/python-trio/trio/issues/476)
  from trio.hazmat import wait_for_child
{PATH}trio_asyncio\_loop.py:267: TrioAsyncioDeprecationWarning: Using trio-asyncio outside of a Trio event loop is deprecated since trio-asyncio 0.10.0 with no replacement
  return _trio_policy.new_event_loop()
Traceback (most recent call last):
  File ".\server.py", line 20, in <module>
    trio_asyncio.run(trio_asyncio.aio_as_trio(server.serve))
  File "{PATH}trio_asyncio\_loop.py", line 429, in run
    return trio.run(_run_task, proc, args)
  File "{PATH}trio\_core\_run.py", line 1795, in run
    raise runner.main_task_outcome.error
  File "{PATH}trio_asyncio\_loop.py", line 427, in _run_task
    return await proc(*args)
  File "{PATH}trio_asyncio\_adapter.py", line 56, in __call__
    return await self.loop.run_aio_coroutine(f)
  File "{PATH}trio_asyncio\_base.py", line 240, in run_aio_coroutine
    return await run_aio_future(fut)
  File "{PATH}trio_asyncio\_util.py", line 45, in run_aio_future
    res = await trio.hazmat.wait_task_rescheduled(abort_cb)
  File "{PATH}trio\_core\_traps.py", line 165, in wait_task_rescheduled
    return (await _async_yield(WaitTaskRescheduled(abort_func))).unwrap()
  File "{PATH}outcome\_sync.py", line 111, in unwrap
    raise captured_error
  File "{PATH}trio_asyncio\_adapter.py", line 19, in _call_defer
    return await proc(*args, **kwargs)
  File "{PATH}uvicorn\main.py", line 393, in serve
    self.install_signal_handlers()
  File "{PATH}uvicorn\main.py", line 565, in install_signal_handlers
    loop.add_signal_handler(sig, self.handle_exit, sig, None)
  File "{PATH}trio_asyncio\_base.py", line 488, in add_signal_handler
    self._check_signal(sig)
AttributeError: 'TrioEventLoop' object has no attribute '_check_signal'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions