Vizonex / Winloop

An Alternative library for uvloop compatability with windows
https://pypi.org/project/winloop
Apache License 2.0
74 stars 7 forks source link

python3.12 fail to close asyncio.Runner #21

Closed pbk20191 closed 1 month ago

pbk20191 commented 2 months ago
Traceback (most recent call last):
  File "C:\Users\pbk\PycharmProjects\pythonProject\foo.py", line 30, in <module>
    asyncio.run(main(), debug=True, loop_factory=winloop.new_event_loop)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\asyncio\runners.py", line 193, in run
    with Runner(debug=debug, loop_factory=loop_factory) as runner:
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\asyncio\runners.py", line 62, in __exit__
    self.close()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64__qbz5n2kfra8p0\Lib\asyncio\runners.py", line 73, in close
    loop.shutdown_default_executor(constants.THREAD_JOIN_TIMEOUT))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: shutdown_default_executor() takes exactly 0 positional arguments (1 given)

winloop.shutdown_default_executor takes 0 argument while asyncio.Runner.close expect to pass argument to the loop.shutdown_default_executor

Vizonex commented 2 months ago

perhaps we need to develop a workaround for this. I did not realize we would have this problem with the library.

Vizonex commented 2 months ago

@pbk20191 I'm going to add a dummy variable to shutdown_default_executor to see if that does anything for you so that 3.12 or above does not have this problem. If that doesn't work contact me again and we can look at finding other ways to fix this bug