1. 27 7月, 2023 1 次提交
  2. 08 7月, 2023 1 次提交
    • B
      asyncio: Remove atexit hook · 62363740
      Ben Darnell 提交于
      This hook was added because of an only-in-CI issue, but we have since
      improved our cleanup of the selector thread. As long as this passes
      CI, I think we can remove the atexit hook.
      
      Fixes #3291
      62363740
  3. 20 6月, 2023 2 次提交
    • B
      asyncio: Modernize type annotations · 6c7d44bd
      Ben Darnell 提交于
      6c7d44bd
    • B
      asyncio: Manage the selector thread with an async generator · 3cca32d5
      Ben Darnell 提交于
      Async generators have a special shutdown protocol which allows
      us to detect the end of the event loop and stop our thread.
      This lets us clean up the thread reliably when the event loop
      is started/stopped via the tornado IOLoop interfaces (which
      explicitly know about the selector thread), or when the
      latest asyncio interfaces are used (asyncio.run or manually
      calling shutdown_asyncgens).
      
      The thread is still leaked when older versions of the asyncio
      interfaces are used (loop.close *without* shutdown_asyncgens), but
      I've been unable to find a solution that does not print leak warnings
      even in the event of a clean shutdown. Use of shutdown_asyncgens is
      now effectively required for apps combining asyncio and tornado.
      This is unfortunate since leaking a thread is relatively expensive
      compared to the usual consequences of failing to call
      shutdown_asyncgens, but it seems to be the best we can do.
      
      Fixes #3173
      3cca32d5
  4. 03 5月, 2023 1 次提交
    • B
      ioloop: Deprecate add_callback_from_signal · b9eb7642
      Ben Darnell 提交于
      I don't believe this method is currently working as intended, and I'm
      not sure it ever has since the move to asyncio. I think this is
      responsible for occasional test failures in CI.
      
      Fixes #3225
      b9eb7642
  5. 16 2月, 2023 2 次提交
  6. 15 2月, 2023 1 次提交
  7. 09 2月, 2023 2 次提交
    • T
      5b91cef2
    • B
      asyncio: Remove obsolete code · a706b98b
      Ben Darnell 提交于
      AsyncioLoop.start() used to save, set, and restore the thread-local
      event loop. This avoided some edge cases in early versions of asyncio;
      this appears to no longer be necessary since Python 3.7 introduced
      the get_running_loop() method.
      
      Removing this logic improves compatibility with Python 3.12, where
      it is difficult if not impossible to do the same thing without
      generating DeprecationWarnings.
      a706b98b
  8. 28 11月, 2022 1 次提交
  9. 21 6月, 2022 1 次提交
  10. 20 6月, 2022 1 次提交
  11. 17 6月, 2022 1 次提交
    • M
      Add stacklevel to deprecation warnings · 019fd527
      Min RK 提交于
      so warnings are associated with the line where the deprecated methods are called
      rather than the line where the warning itself is
      019fd527
  12. 16 6月, 2022 2 次提交
  13. 15 6月, 2022 1 次提交
    • M
      Allow passing asyncio_loop argument to AsyncIOLoop · a86d3c77
      Min RK 提交于
      allows patterns of creating and explicitly passing the asyncio loop before creating IOLoop
      
      For example: creating a loop with the non-default event loop policy without having to set the current policy
      a86d3c77
  14. 31 3月, 2022 1 次提交
  15. 19 3月, 2022 2 次提交
  16. 17 1月, 2022 3 次提交
    • B
      asyncio: Avoid deprecation warning in start on py310 · 2cecd603
      Ben Darnell 提交于
      Also avoid deprecated asyncio.get_event_loop in asyncio_test.
      2cecd603
    • B
      ioloop: Deprecate setting current ioloop for python 3.10 · ebba482a
      Ben Darnell 提交于
      asyncio.get_event_loop and related methods are deprecated in python
      3.10, so deprecate some IOLoop functionality to match. Specifically,
      make_current, clear_current, and the IOLoop constructor are deprecated
      in favor of initializing the asyncio event loop and calling
      IOLoop.current(). (The IOLoop constructor is not deprecated if
      make_current=False is used. This is useful in test frameworks but is
      not expected to see general use).
      ebba482a
    • B
      asyncio: Deprecate AnyThreadEventLoopPolicy · 5f2405af
      Ben Darnell 提交于
      Implicit creation of event loops has been deprecated in Python 3.10.
      Since AnyThreadEventLoopPolicy modifies the rules for implicit loop
      creation, it is also deprecated.
      5f2405af
  17. 03 9月, 2021 1 次提交
  18. 01 6月, 2021 1 次提交
  19. 30 5月, 2021 1 次提交
  20. 19 5月, 2021 1 次提交
  21. 10 5月, 2021 1 次提交
  22. 01 11月, 2020 1 次提交
  23. 24 10月, 2020 1 次提交
  24. 30 9月, 2020 1 次提交
  25. 13 9月, 2020 1 次提交
    • P
      Update super usage (#2912) · b3c63fbc
      Poruri Sai Rahul 提交于
      On Python 3, super does not need to be called with arguments where as on
      Python 2, super needs to be called with a class object and an instance.
      
      This commit updates the super usage using automated regex-based search
      and replace. After the automated changes were made, each change was
      individually checked before committing.
      b3c63fbc
  26. 02 9月, 2020 3 次提交
    • B
      asyncio: Refactor selector to callbacks instead of coroutine · b03acc54
      Ben Darnell 提交于
      Restarting the event loop to "cleanly" shut down a coroutine introduces
      other problems (mainly manifesting as errors logged while running
      tornado.test.gen_test). Replace the coroutine with a pair of callbacks
      so we don't need to do anything special to shut down without logging
      warnings.
      b03acc54
    • B
      asyncio: Rework AddThreadSelectorEventLoop · 5cfe2fc2
      Ben Darnell 提交于
      Running a whole event loop on the other thread leads to tricky
      synchronization problems. Instead, keep as much as possible on the
      main thread, and call out to a second thread only for the blocking
      select system call itself.
      5cfe2fc2
    • B
      asyncio: Improve support Python 3.8 on Windows · 89d9c417
      Ben Darnell 提交于
      This commit removes the need for applications to work around the
      backwards-incompatible change to the default event loop. Instead,
      Tornado will detect the use of the windows proactor event loop and
      start a selector event loop in a separate thread.
      
      Closes #2804
      89d9c417
  27. 15 5月, 2020 1 次提交
  28. 20 1月, 2020 1 次提交
  29. 07 10月, 2018 1 次提交
    • B
      *: Adopt black as code formatter · 72026c5e
      Ben Darnell 提交于
      It occasionally makes some odd-looking decisions and uses a lot of
      vertical space but overall it's a big improvement, especially for the
      dense type signatures.
      72026c5e
  30. 17 9月, 2018 1 次提交
    • M
      Add thread identity check to add_callback (#2469) · 627eafb3
      Matthew Rocklin 提交于
      * Add thread identity check to add_callback
      
      Fixes #2463
      
      This reduces the overhead of add_callback when called on the same thread
      as the event loop.  This uses asyncio's call_soon rather than
      call_soon_threadsafe.
      
      * Separately define add_callback_from_signal
      627eafb3
  31. 12 8月, 2018 1 次提交