Commit graph

781 commits

Author SHA1 Message Date
Andrew Svetlov
f47984b560
[3.9] bpo-45997: Fix asyncio.Semaphore re-acquiring order (GH-31910) (GH-32049)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>.
(cherry picked from commit 32e77154dd)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-03-22 17:16:27 +02:00
Miss Islington (bot)
4e9bb27eae
bpo-47038: Increase a test timeout for slow CI machines (GH-31951)
(cherry picked from commit a7c5414832)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-03-16 18:19:18 -07:00
Miss Islington (bot)
0412e3ae03
bpo-47038: Rewrite missed asyncio.wait_for test to use IsolatedAnsyncioTestCase (GH-31946)
(cherry picked from commit 3dd9bfac04)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-03-16 16:44:22 -07:00
Andrew Svetlov
3244659521
[3.9] bpo-47038: Rewrite asyncio.wait_for test to use IsolatedAsyncioTestCase (GH-31942). (GH-31944)
(cherry picked from commit dd0082c627)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-03-16 22:45:39 +02:00
Miss Islington (bot)
64a68c39cb
bpo-43253: Don't call shutdown() for invalid socket handles (GH-31892)
(cherry picked from commit 70155412f1)

Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2022-03-15 08:23:47 -07:00
Jelle Zijlstra
f7f7838b41
[3.9] bpo-46198: rename duplicate tests and remove unused code (GH-30297) (GH-31797)
(cherry picked from commit 6c83c8e6b5)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-03-10 13:18:27 -08:00
Miss Islington (bot)
f3bb8fe4e8
Inherit asyncio proactor datagram transport from asyncio.DatagramTransport (GH-31512)
(cherry picked from commit cff4d5c5d2)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-02-22 16:08:43 -08:00
Miss Islington (bot)
29e8c43b32
bpo-46827: pass sock.type to getaddrinfo in sock_connect (GH-31499)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
(cherry picked from commit 8fb94893e4)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-02-22 13:10:04 -08:00
Andrew Svetlov
a6116a980c
[3.9] bpo-46672: fix NameError in asyncio.gather if type check fails (GH-31187) (GH-31441)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-02-20 14:39:21 +02:00
Andrew Svetlov
a65be6e077
[3.9] Fix warning: asyncio.events._event_loop_policy was modified by test_asyncio (GH-31253). (GH-31256)
(cherry picked from commit 012e77eb5c)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-02-10 15:32:05 +02:00
Miss Islington (bot)
f9ff0bf515
bpo-41682: fixed flaky test test_sendfile_close_peer_in_the_middle_of_receiving (GH-30845) (#30861)
(cherry picked from commit 1c705fda8f)

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

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-01-25 18:40:34 +01:00
Miss Islington (bot)
ba932d9024
bpo-41682: Skip unstable test_asyncio sendfile test on Windows (GH-30801)
(cherry picked from commit 1ded8ed8e8)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-22 16:20:49 -08:00
Kumar Aditya
6ed874f8c5
[3.9] bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777) (GH-30785)
Automerge-Triggered-By: GH:asvetlov
2022-01-22 04:52:24 -08:00
Miss Islington (bot)
3c4a3745b9
bpo-46425: fix direct invocation of asyncio tests (GH-30725)
(cherry picked from commit 5a5340044c)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
2022-01-22 03:54:07 -08:00
Miss Islington (bot)
07229054a1
[3.9] bpo-23819: Fix asyncio tests on python optimized mode (GH-30195) (GH-30265)
(cherry picked from commit a23ab7b6d8)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2021-12-26 13:54:18 +02:00
Andrew Svetlov
2352644377
Fix test error about deprecation warning (#30205) 2021-12-19 20:12:24 +02:00
Andrew Svetlov
f8fce5e4e4
[3.9] bpo-46129: Rewrite asyncio.locks tests with IsolatedAsyncioTestCase (GH-30198) (GH-30204)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>.
(cherry picked from commit 9c06fd8951)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2021-12-19 18:59:37 +02:00
Miss Islington (bot)
99a9b34331
bpo-37658: Actually return result in race condition (GH-29202) (GH-29832)
(cherry picked from commit 934a826237)

Co-authored-by: Sam Bull <aa6bs0@sambull.org>

Co-authored-by: Sam Bull <aa6bs0@sambull.org>
2021-11-30 15:39:13 +02:00
Christian Clauss
4346b81cc6
[3.9] Fix typos in the Lib directory (GH-28775) (GH-28803)
Fix typos in the Lib directory as identified by codespell.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
(cherry picked from commit 745c9d9dfc)

Automerge-Triggered-By: GH:JulienPalard
2021-10-07 08:42:38 -07:00
Serhiy Storchaka
a328a13b70
[3.9] bpo-45097: Fix deprecation warnings in test_asyncio (GH-28236) 2021-09-08 17:59:40 +02:00
Serhiy Storchaka
c967bd523c
[3.9] bpo-45097: Remove incorrect deprecation warnings in asyncio. (GH-28153)
Deprecation warnings about the loop argument were incorrectly emitted
in cases when the loop argument was used inside the asyncio library,
not from user code.
2021-09-04 20:54:50 +03:00
Serhiy Storchaka
330aabbbbe
[3.9] bpo-25130: Add calls of gc.collect() in tests to support PyPy (GH-28005). (GH-28028)
(cherry picked from commit 2a8127cafe)
2021-08-29 15:08:32 +03:00
Miss Islington (bot)
970533e65c
[3.9] bpo-45011: Fix test_asyncio without C module _asyncio (GH-27968) (GH-27970)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 7dc505b865)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-08-26 19:56:50 +02:00
Miss Islington (bot)
d5781e9730
bpo-44968: Fix test_subprocess_wait_no_same_group in test_asyncio (GH-27870)
The code of the test was never executed because the test function
was unintentionally converted to a generator function.
(cherry picked from commit 585390fdd8)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-08-21 13:29:18 -07:00
Sam Bull
b2779b2aa1
[3.9] bpo-44815: Always show deprecation in asyncio.gather/sleep() (GH-27569)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-08-18 20:47:55 +02:00
Miss Islington (bot)
0ff487b8ab
bpo-44287: asyncio test_popen() uses longer timeout (GH-26832)
Fix asyncio test_popen() of test_windows_utils by using a longer
timeout. Use military grade battle-tested test.support.SHORT_TIMEOUT
timeout rather than a hardcoded timeout of 10 seconds: it's 30
seconds by default, but it is made longer on slow buildbots.

WaitForMultipleObjects() timeout argument is in milliseconds.
(cherry picked from commit be1cb3214d)

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-06-21 17:29:13 -07:00
Miss Islington (bot)
b3c50b29e1
bpo-38323: Skip SubprocessMultiLoopWatcherTest as they can hang the test suite (GH-26542)
(cherry picked from commit f171877ebe)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2021-06-04 16:59:55 -07:00
Christian Heimes
cdf0287979
[3.9] bpo-43522: Fix SSLContext.hostname_checks_common_name (GH-24899) (GH-25451)
Fix problem with ssl.SSLContext.hostname_checks_common_name. OpenSSL does not
copy hostflags from *struct SSL_CTX* to *struct SSL*.

Signed-off-by: Christian Heimes <christian@python.org>.
(cherry picked from commit b467d9a240)

Co-authored-by: Christian Heimes <christian@python.org>
2021-04-17 11:35:24 +02:00
Miss Islington (bot)
82dbfd5a04
bpo-41891: ensure asyncio.wait_for waits for task completion (GH-22461) (#23840)
(cherry picked from commit 17ef4319a3)

Co-authored-by: Richard Kojedzinszky <rkojedzinszky@users.noreply.github.com>

Co-authored-by: Richard Kojedzinszky <rkojedzinszky@users.noreply.github.com>
2020-12-18 11:19:10 -08:00
Miss Islington (bot)
9f26833ced
bpo-42553: Fix test_asyncio.test_call_later() (GH-23627)
Fix test_asyncio.test_call_later() race condition: don't measure
asyncio performance in the call_later() unit test. The test failed
randomly on the CI.
(cherry picked from commit 7e5e13d113)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-12-03 05:20:07 -08:00
Miss Islington (bot)
df6c8bcffe
bpo-34215: Clarify IncompleteReadError message when "expected" is None (GH-21925) (GH-23539)
Co-Authored-By: Tyler Bell <mrbell321@gmail.com>
(cherry picked from commit 8085f742f4)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2020-11-28 17:07:51 +02:00
Miss Islington (bot)
33922cb0aa
bpo-42140: Improve asyncio.wait function (GH-22938)
GH- Improve asyncio.wait function

The original code creates the futures set two times.
We can create this set before, avoiding the second creation.

This new behaviour [breaks the aiokafka library](https://github.com/aio-libs/aiokafka/pull/672), because it gives an iterator to that function, so the second iteration become empty.

Automerge-Triggered-By: GH:1st1
(cherry picked from commit 7e5ef0a571)

Co-authored-by: Diogo Dutra <diogodutradamata@gmail.com>
2020-11-10 15:10:57 -08:00
Miss Islington (bot)
90115a2cf7
bpo-42183: Fix a stack overflow error for asyncio Task or Future repr() (GH-23020)
The overflow occurs under some circumstances when a task or future
recursively returns itself.

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
(cherry picked from commit 42d873c63a)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2020-11-10 06:20:52 -08:00
Miss Skeleton (bot)
e43bee7e11
bpo-38912: fix close before connect callback in test_asyncio SSL tests (GH-22691)
Reduces the rate at which the ENV CHANGED failure occurs in test_asyncio SSL tests (due to unclosed transport), but does not 100% resolve it.
(cherry picked from commit de73d432bb)

Co-authored-by: Justin Turner Arthur <justinarthur@gmail.com>
2020-10-19 18:40:01 -07:00
Łukasz Langa
7e356f17e4
[3.9] bpo-41687: Fix sendfile implementation to work with Solaris (GH-22040) (GH-22273)
(cherry picked from commit 8c0be6fd91)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2020-09-16 13:52:26 +02:00
Miss Islington (bot)
8d68e59f11
bpo-39010: Improve test shutdown (GH-22066) (#22082)
Simply closing the event loop isn't enough to avoid warnings. If we
don't also shut down the event loop's default executor, it sometimes
logs a "dangling thread" warning.

Follow-up to GH-22017
(cherry picked from commit be435ae2b0)

Co-authored-by: Ben Darnell <ben@bendarnell.com>

Co-authored-by: Ben Darnell <ben@bendarnell.com>
2020-09-03 13:54:43 -07:00
Miss Islington (bot)
a2680058ee
bpo-41696: Fix handling of debug mode in asyncio.run (GH-22069) (#22071)
* bpo-41696: Fix handling of debug mode in asyncio.run

This allows PYTHONASYNCIODEBUG or -X dev to enable asyncio debug mode
when using asyncio.run

* 📜🤖 Added by blurb_it.

Co-authored-by: hauntsaninja <>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit 0770ad948c)

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2020-09-03 13:54:09 -07:00
Miss Islington (bot)
49571c0b0e
bpo-39010: Fix errors logged on proactor loop restart (GH-22017) (#22034)
Stopping and restarting a proactor event loop on windows can lead to
spurious errors logged (ConnectionResetError while reading from the
self pipe). This fixes the issue by ensuring that we don't attempt
to start multiple copies of the self-pipe reading loop.
(cherry picked from commit ea5a6363c3)

Co-authored-by: Ben Darnell <ben@bendarnell.com>

Co-authored-by: Ben Darnell <ben@bendarnell.com>
2020-09-03 12:38:29 -07:00
Miss Islington (bot)
9de6be4e2a
bpo-37658: Fix asyncio.wait_for() to respect waited task status (GH-21894) (GH-21964)
Currently, if `asyncio.wait_for()` itself is cancelled it will always
raise `CancelledError` regardless if the underlying task is still
running.  This is similar to a race with the timeout, which is handled
already.
(cherry picked from commit a2118a1462)

Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
2020-08-26 19:15:35 +02:00
Miss Islington (bot)
1036ccb55d
bpo-32751: Wait for task cancel in asyncio.wait_for() when timeout <= 0 (GH-21895) (GH-21963)
When I was fixing bpo-32751 back in GH-7216 I missed the case when
*timeout* is zero or negative.  This takes care of that.

Props to @aaliddell for noticing the inconsistency.
(cherry picked from commit c517fc7121)

Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
2020-08-26 19:14:59 +02:00
Miss Islington (bot)
4ff8e5ba4f
bpo-41317: Remove reader on cancellation in asyncio.loop.sock_accept() (GH-21595)
(cherry picked from commit 0dd98c2d00)

Co-authored-by: Alex Grönholm <alex.gronholm@nextday.fi>
2020-07-23 13:02:47 -07:00
Miss Islington (bot)
df59293bf0
bpo-40967: Remove deprecated asyncio.Task.current_task() and asyncio.Task.all_tasks() (GH-20874)
(cherry picked from commit 004e64e805)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@lenstra.fr>
2020-07-01 21:06:51 -07:00
Victor Stinner
b1e7361134
bpo-38377: Add support.skip_if_broken_multiprocessing_synchronize() (GH-20944) (GH-20962)
On Linux, skip tests using multiprocessing if the current user cannot
create a file in /dev/shm/ directory. Add the
skip_if_broken_multiprocessing_synchronize() function to the
test.support module.

(cherry picked from commit ddbeb2f3e0)
2020-06-18 17:19:59 +02:00
Miss Islington (bot)
83cd968f5c
bpo-30064: Fix slow asyncio sock test (GH-20868)
Using a log2n way to fill a much smaller buffer, and receiving in a cleaner way with EOF.

The failing test was reproducible using the following command thanks to @aeros :

```bash
./python -m test test_asyncio.test_sock_lowlevel --match test_sock_client_racing -j100 -F -v
```

According to test results, we may still need to bump the timeout:

5aad027db9/Lib/test/test_asyncio/test_sock_lowlevel.pyGH-L256-L257
(cherry picked from commit 8f04a84755)

Co-authored-by: Fantix King <fantix.king@gmail.com>
2020-06-14 01:08:08 -07:00
Miss Islington (bot)
6637bd4516
bpo-30064: Properly skip unstable loop.sock_connect() racing test (GH-20494)
(cherry picked from commit dc4eee9e26)

Co-authored-by: Fantix King <fantix.king@gmail.com>
2020-05-28 15:17:33 -07:00
Miss Islington (bot)
1d82f00367
bpo-30064: Fix unstable asyncio "racing" socket tests (GH-20485)
Skip new "racing" socket tests which fail randomly until someone fix
them, to ease analysis of buildbot failures (skip tests which are
known to be broken/unstable).
(cherry picked from commit 84ee7e1573)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-05-28 07:28:17 -07:00
Miss Islington (bot)
3a2667d91e
bpo-30064: Fix asyncio loop.sock_* race condition issue (GH-20369)
(cherry picked from commit 210a137396)

Co-authored-by: Fantix King <fantix.king@gmail.com>
2020-05-27 13:39:03 -07:00
Miss Islington (bot)
7f77ac463c
bpo-40696: Fix a hang that can arise after gen.throw() (GH-20287)
This updates _PyErr_ChainStackItem() to use _PyErr_SetObject()
instead of _PyErr_ChainExceptions(). This prevents a hang in
certain circumstances because _PyErr_SetObject() performs checks
to prevent cycles in the exception context chain while
_PyErr_ChainExceptions() doesn't.
(cherry picked from commit 7c30d12bd5)

Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
2020-05-22 14:35:22 -07:00
Miss Islington (bot)
3e650545bf
bpo-32309: Add support for contextvars in asyncio.to_thread() (GH-20278)
Allows contextvars from the main thread to be accessed in the separate thread used in `asyncio.to_thread()`. See the [discussion](https://github.com/python/cpython/pull/20143GH-discussion_r427808225) in GH-20143 for context.

Automerge-Triggered-By: @aeros
(cherry picked from commit 0f56263e62)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2020-05-20 22:38:00 -07:00
Miss Islington (bot)
e2991308c9
bpo-32309: Implement asyncio.to_thread() (GH-20143)
Implements `asyncio.to_thread`, a coroutine for asynchronously running IO-bound functions in a separate thread without blocking the event loop. See the discussion starting from [here](https://github.com/python/cpython/pull/18410GH-issuecomment-628930973) in GH-18410 for context.

Automerge-Triggered-By: @aeros
(cherry picked from commit cc2bbc2227)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2020-05-19 03:03:25 -07:00