Commit Graph

880 Commits

Author SHA1 Message Date
Miss Islington (bot) 2cd1b9c2ca
[3.11] gh-103607: Fix `pause_reading` to work when called from `connection_made` in `asyncio`. (GH-17425) (#103918)
gh-103607: Fix `pause_reading` to work when called from `connection_made` in `asyncio`. (GH-17425)
(cherry picked from commit 78942ecd9b)

Co-authored-by: Itayazolay <itayazolay@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-04-27 10:29:54 +00:00
Miss Islington (bot) a9ece4a839
gh-102780: Fix uncancel() call in asyncio timeouts (GH-102815)
Also use `raise TimeOut from <CancelledError instance>` so that the CancelledError is set
in the `__cause__` field rather than in the `__context__` field.

(cherry picked from commit 04adf2df39)

Co-authored-by: Kristján Valur Jónsson <sweskman@gmail.com>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-03-22 11:23:47 -07:00
Shantanu cd0fe5ba09
[3.11] gh-101326: Fix regression when passing None to FutureIter.throw (GH-101327) (#101328)
(cherry picked from commit a178ba82bf)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2023-01-25 13:01:13 -08:00
Miss Islington (bot) d06315a6fa
[3.11] GH-100573: Fix server hang caused by os.stat() on named pipe (Windows) (GH-100959) (#101019)
(cherry picked from commit 1bc7a73683)
2023-01-13 13:58:20 -08:00
Serhiy Storchaka 1b2459dc64
[3.11] gh-100160: Remove any deprecation warnings in asyncio.get_event_loop() (#100412)
Some deprecation warnings will reappear (in a slightly different form) in 3.12.

Co-authored-by: Guido van Rossum <guido@python.org>
2023-01-10 12:20:09 -08:00
Miss Islington (bot) ad40764f5b
GH-86508: skip binding to local addresses of different family in `asyncio.open_connection` (GH-100615)
(cherry picked from commit ba8dcdbcab)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-01-04 00:28:00 -08:00
Miss Islington (bot) ae8520c709
GH-100133: fix `asyncio` subprocess losing `stderr` and `stdout` output (GH-100154)
(cherry picked from commit a7715ccfba)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-12-21 02:24:19 -08:00
Serhiy Storchaka 3fae04b10e
[3.11] gh-93453: Only emit deprecation warning in asyncio.get_event_loop when a new event loop is created (#99949)
It no longer emits a deprecation warning if the current event loop was set.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-12-06 16:15:44 +01:00
Miss Islington (bot) 7aa87bba05
gh-60203: Always pass True/False as boolean arguments in tests (GH-99983)
Unless we explicitly test non-bool values.
(cherry picked from commit 76f43fc09a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-12-04 04:50:46 -08:00
Miss Islington (bot) e1e8a15abf
GH-98219: reduce sleep time in `asyncio` subprocess test (GH-99464)
(cherry picked from commit 619cadcda6)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-11-15 07:52:38 -08:00
Miss Islington (bot) 90de4b76b9
[3.11] gh-99357: Close the event loop when it is no longer used in test_uncancel_structured_blocks (GH-99414) (#99424)
(cherry picked from commit 99972dc745)

Co-authored-by: Xiao Chen <chenxiao_7@163.com>
2022-11-14 10:52:10 -08:00
Charlie Zhao 2b0cbb90c3
[3.11] gh-98793: Fix typecheck in `overlapped.c` (GH-98835) (#98889)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
(cherry picked from commit 3ac8c0ab6e)
2022-10-31 11:21:01 -07:00
Miss Islington (bot) 8e475adf30
gh-98703: Add tests for closing `_ProactorSocketTransport` with proactor event loop (GH-98730)
(cherry picked from commit 96ae80f1d0)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-10-26 20:33:19 -07:00
Miss Islington (bot) 8950689dce
[3.11] GH-89237: fix hang in proactor `subprocess.wait_closed()` (GH-98572) (#98620)
GH-89237: fix hang in proactor `subprocess.wait_closed()` (GH-98572)
(cherry picked from commit ad1dc3ebb6)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-10-24 20:34:08 -07:00
Miss Islington (bot) 3a1eb81abf
GH-98407: fix `test_kill_issue43884` to not leak child processes (GH-98491)
(cherry picked from commit 3b2724abcf)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-10-24 12:41:10 -07:00
Miss Islington (bot) 0bba980c5f
[3.11] gh-98174: Handle EPROTOTYPE under macOS in test_sendfile_fallback_close_peer_in_the_middle_of_receiving (GH-98316) (#98357)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
(cherry picked from commit 3e82ad05b1)

Co-authored-by: fancidev <fancidev@gmail.com>
2022-10-18 08:21:58 -07:00
Miss Islington (bot) 595ef03c7c
bpo-46364: Use sockets for stdin of asyncio only on AIX (GH-30596)
Signed-off-by: Christoph Hamsen <hamsen.christoph@posteo.de>
Co-authored-by: July Tikhonov <july.tikh@gmail.com>
(cherry picked from commit c9ed0327a9)

Co-authored-by: Christoph Hamsen <37963496+xopham@users.noreply.github.com>
2022-10-13 10:27:31 -07:00
Miss Islington (bot) d163d5976d
GH-90985: Revert "Deprecate passing a message into cancel()" (GH-97999)
Reason: we were too hasty in deprecating this.
We shouldn't deprecate it before we have a replacement.
(cherry picked from commit 09de8d7aaf)

Co-authored-by: Guido van Rossum <guido@python.org>
2022-10-06 18:50:25 -07:00
Miss Islington (bot) aec133347e
gh-88050: Fix asyncio subprocess to kill process cleanly when process is blocked (GH-32073)
(cherry picked from commit 7015e13797)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-10-05 10:48:48 -07:00
Miss Islington (bot) 3614bbb8eb
gh-90908: Document asyncio.Task.cancelling() and asyncio.Task.uncancel() (GH-95253)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
(cherry picked from commit f00645d5db)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-10-01 11:10:04 -07:00
Miss Islington (bot) 3124618fd5
GH-97592: Fix crash in C remove_done_callback due to evil code (GH-97660)
Evil code could cause fut_callbacks to be cleared when PyObject_RichCompareBool is called.
(cherry picked from commit 63780f4599)

Co-authored-by: Guido van Rossum <guido@python.org>
2022-09-30 13:22:48 -07:00
Miss Islington (bot) 9a9bf88898
gh-97545: Make Semaphore run faster. (GH-97549)
(cherry picked from commit 68c46ae68b)

Co-authored-by: Cyker Way <cykerway@gmail.com>
2022-09-26 17:00:53 -07:00
Miss Islington (bot) 773dbb9e3a
gh-90155: Fix bug in asyncio.Semaphore and strengthen FIFO guarantee (GH-93222)
The main problem was that an unluckily timed task cancellation could cause
the semaphore to be stuck. There were also doubts about strict FIFO ordering
of tasks allowed to pass.

The Semaphore implementation was rewritten to be more similar to Lock.
Many tests for edge cases (including cancellation) were added.
(cherry picked from commit 24e0379624)

Co-authored-by: Cyker Way <cykerway@gmail.com>
2022-09-22 09:58:35 -07:00
Miss Islington (bot) 2e9f29e6a6
GH-74116: Allow multiple drain waiters for asyncio.StreamWriter (GH-94705) (#96395)
(cherry picked from commit e5b2453e61)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-08-30 12:00:21 +01:00
Miss Islington (bot) 36c114ab11
GH-95704: Don't suppress errors from tasks when TG is cancelled (GH-95761)
When a task catches CancelledError and raises some other error,
the other error should not silently be suppressed.

Any scenario where a task crashes in cleanup upon cancellation
will now result in an ExceptionGroup wrapping the crash(es)
instead of propagating CancelledError and ignoring the side errors.

NOTE: This represents a change in behavior (hence the need to
change several tests).  But it is only an edge case.

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
(cherry picked from commit f51f54f39d)

Co-authored-by: Guido van Rossum <guido@python.org>
2022-08-17 10:04:59 -07:00
Miss Islington (bot) 8bd7a0b581
GH-95899: fix asyncio.Runner to call set_event_loop only once (GH-95900) (#96003)
(cherry picked from commit 914f6367a0)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-08-15 15:01:23 -07:00
Miss Islington (bot) 24dd1429e5
gh-95724: Clarify taskgroups.py license. (GH-95847)
(cherry picked from commit 7da4937748)

Co-authored-by: Yury Selivanov <yury@edgedb.com>
2022-08-11 16:45:30 -07:00
Miss Islington (bot) 954b8875a0
gh-95573: Reduce test data size in test_asyncio/test_ssl.py (GH-95668) (GH-95705)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 3a9e1fda7a)

Co-authored-by: Fantix King <fantix.king@gmail.com>
2022-08-05 11:23:57 +02:00
Miss Islington (bot) 0e636e4e7b
gh-95573: Fix a mistake in asyncio ssl tests suppressing all logs (GH-95687) (GH-95699)
(cherry picked from commit e1d68b3ce7)

Co-authored-by: Fantix King <fantix.king@gmail.com>
2022-08-05 10:07:15 +02:00
Miss Islington (bot) 5ac3d0f573
gh-91323: Revert "Allow overriding a future compliance check in asyncio.Task (GH-32197)" (GH-95442) (GH-95652)
This reverts commit d4bb38f82b.
(cherry picked from commit 0342c93a6b)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-08-04 18:07:39 +02:00
Miss Islington (bot) 2d84fe59c0
GH-95289: Always call uncancel() when parent cancellation is requested (GH-95602)
Co-authored-by: Guido van Rossum <guido@python.org>
(cherry picked from commit 2fef27589e)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-08-04 07:50:54 -07:00
Miss Islington (bot) 1ed023b7c0
gh-95597: Fix typo in Lib directory files (GH-95599)
(cherry picked from commit b53aed76d2)

Co-authored-by: Jo, Yunjin <black33jo@gmail.com>
2022-08-03 14:43:01 -07:00
Miss Islington (bot) efeda8b4a1
GH-95097: fix `asyncio.run` for tasks without `uncancel` method (GH-95211) (GH-95387)
(cherry picked from commit 54f48844d1)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-07-29 14:38:02 +02:00
Miss Islington (bot) 19d953682e
gh-95051: ensure that timeouts scheduled with `asyncio.Timeout` that have already expired are deliverered promptly (GH-95109) (GH-95216)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
(cherry picked from commit 0c6f898005)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-07-26 12:16:12 +02:00
Miss Islington (bot) d19b5d8533
gh-95010: Fix asyncio GenericWatcherTests.test_create_subprocess_fails_with_inactive_watcher (GH-95009)
The test was never run, because it was missing the TestCase class.
The test failed because the wrong attribute was patched.
(cherry picked from commit 834bd5dd76)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-07-21 06:01:05 -07:00
Miss Islington (bot) 8d0249e345
gh-72889: Remove redundant mock.Mock()._is_coroutine = False workarounds (GH-94926)
(cherry picked from commit 07aeb7405e)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-07-17 10:49:01 -07:00
Miss Islington (bot) 91176d3883
[3.11] bpo-45924: Fix asyncio incorrect traceback when future's exception is raised multiple times (GH-30274) (#94747)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-07-11 14:17:32 +01:00
Miss Islington (bot) 0187b60106
GH-93896: AAlways set event loop in asyncio.run and IsolatedAsyncioTestCase (GH-94593)
(cherry picked from commit 14fea6b4d2)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-07-06 08:48:37 -07:00
Miss Islington (bot) 9ebec7d46c
gh-84753: Make inspect.iscoroutinefunction() work with AsyncMock (GH-94050) (GH-94460)
The inspect version was not working with unittest.mock.AsyncMock.

The fix introduces special-casing of AsyncMock in
`inspect.iscoroutinefunction` equivalent to the one
performed in `asyncio.iscoroutinefunction`.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 4261b6bffc)

Co-authored-by: Mehdi ABAAKOUK <sileht@sileht.net>
2022-06-30 20:04:42 +02:00
Miss Islington (bot) 7fe949e5ea
GH-94398: TaskGroup: Fail create_task() during shutdown (GH-94400) (GH-94463)
Once the task group is shutting down, it should not be possible to create a new task.
Here "shutting down" means `self._aborting` is set, indicating that at least one task
has failed and we have cancelled all others.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 594c369949)

Co-authored-by: Guido van Rossum <guido@python.org>
2022-06-30 20:02:42 +02:00
Miss Islington (bot) d1fd7393a2
GH-93850: Fix test_asyncio exception ignored tracebacks (GH-93854)
(cherry picked from commit b415c5f1aa)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-06-15 08:10:40 -07:00
Miss Islington (bot) a848a9894d
gh-93247: Fix assert function in asyncio locks test (GH-93248)
(cherry picked from commit 9081bbd036)

Co-authored-by: Cyker Way <cykerway@gmail.com>
2022-06-05 18:47:07 -07:00
Miss Islington (bot) 64593f2fed
gh-90978: asyncio TestSSL uses SHORT_TIMEOUT (GH-92642)
TestSSL of asyncio now uses support.SHORT_TIMEOUT rather than
hardcoded timeouts like 5, 10 or 40 seconds.
(cherry picked from commit 1d1929fcb5)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-05-11 14:56:07 -07:00
Victor Stinner 973a5203c1
gh-90978: test_ssl of test_asyncio uses LONG_TIMEOUT (#92402)
On slow buildbot workers, some test_ssl tests fail randomly because
of short timeout (30 seconds). Use support.LONG_TIMEOUT instead which
is longer and also adjusted (by regrtest --timeout option) on
buildbot workers known to be slow.
2022-05-06 15:18:56 +01:00
Gregory P. Smith f6dd14c653
gh-82616: Add process_group support to subprocess.Popen (#23930)
One more thing that can help prevent people from using `preexec_fn`.

Also adds conditional skips to two tests exposing ASAN flakiness on the Ubuntu 20.04 Address Sanitizer Github CI system. When that build is run on more modern systems the "problem" does not show up. It seems ASAN implementation related.

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-05-05 16:22:32 -07:00
David Hewitt 1cd8c29dac
gh-91880: add try/except around `signal.signal` (#91881)
Fixes gh-91880.
2022-04-25 08:56:20 -07:00
Serhiy Storchaka 090721721b
Simplify testing the warning filename (GH-91868)
The context manager result has the "filename" attribute.
2022-04-24 10:23:59 +03:00
Oleg Iarygin 6217864fe5
gh-79156: Add start_tls() method to streams API (#91453)
The existing event loop `start_tls()` method is not sufficient for
connections using the streams API. The existing StreamReader works
because the new transport passes received data to the original protocol.
The StreamWriter must then write data to the new transport, and the
StreamReaderProtocol must be updated to close the new transport
correctly.

The new StreamWriter `start_tls()` updates itself and the reader
protocol to the new SSL transport.

Co-authored-by: Ian Good <icgood@gmail.com>
2022-04-15 14:23:14 +02:00
Andrew Svetlov d4bb38f82b
bpo-47167: Allow overriding a future compliance check in asyncio.Task (GH-32197) 2022-04-01 04:25:15 +03:00
Andrew Svetlov f08a191882
bpo-39622: Interrupt the main asyncio task on Ctrl+C (GH-32105)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-03-30 15:15:06 +03:00