summaryrefslogtreecommitdiff
path: root/Lib/asyncio
Commit message (Collapse)AuthorAgeFilesLines
* [3.7] bpo-34263 Cap timeout submitted to epoll/select etc. to one day. ↵Miss Islington (bot)2018-07-311-1/+4
| | | | (GH-8532) (GH-8586)
* bpo-33833: Fix ProactorSocketTransport AssertionError (GH-7893)Miss Islington (bot)2018-07-301-0/+4
| | | | | (cherry picked from commit 9045199c5aaeac9b52537581be127d999b5944ee) Co-authored-by: twisteroid ambassador <twisteroidambassador@users.noreply.github.com>
* bpo-27500: Fix static version of getaddrinfo to resolve IPv6 (GH-7993)Miss Islington (bot)2018-06-281-4/+10
| | | | | (cherry picked from commit d904c238ca3551750cb97d15d827c3e525970867) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-30805: Avoid race condition with debug logging (GH-7545)Miss Islington (bot)2018-06-081-2/+4
| | | | | | Supersedes https://github.com/python/cpython/pull/2490 (cherry picked from commit 12f482e0ae33021c04264294f33fa6baa9617cec) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-33694: Fix typo in helper function name (GH-7522)Miss Islington (bot)2018-06-083-3/+3
| | | | | | | | | _feed_data_to_bufferred_proto() renamed to _feed_data_to_buffered_proto() ("bufferred" => "buffered"). Typo spotted by Nathaniel J. Smith. (cherry picked from commit ff6c07729211fb98431a2793e074d07a21e0650a) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-33792: Add selector and proactor windows policies (GH-7487)Miss Islington (bot)2018-06-071-3/+8
| | | | | (cherry picked from commit 8f4042964d5b0ddf5cdf87862db962ba64e3f64a) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-33694: Fix race condition in asyncio proactor (GH-7498) (GH-7499)Miss Islington (bot)2018-06-083-145/+73
| | | | | | | | | | | | | | | | | | | The cancellation of an overlapped WSARecv() has a race condition which causes data loss because of the current implementation of proactor in asyncio. No longer cancel overlapped WSARecv() in _ProactorReadPipeTransport to work around the race condition. Remove the optimized recv_into() implementation to get simple implementation of pause_reading() using the single _pending_data attribute. Move _feed_data_to_bufferred_proto() to protocols.py. Remove set_protocol() method which became useless. (cherry picked from commit 79790bc35fe722a49977b52647f9b5fe1deda2b7) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-33769: start_tls: Fix error message; cancel callbacks on error (GH-7403) ↵Miss Islington (bot)2018-06-052-3/+6
| | | | | | | | (GH-7428) In addition to that, mark SSLTransport as "closed" in its "abort()" method to prevent bogus warnings. (cherry picked from commit 415bc46a78e785f357c8960ae70f18a6b6cccbb6) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-33734: asyncio/ssl: a bunch of bugfixes (GH-7321) (GH-7396)Miss Islington (bot)2018-06-044-37/+39
| | | | | | | | | | * Fix AttributeError (not all SSL exceptions have 'errno' attribute) * Increase default handshake timeout from 10 to 60 seconds * Make sure start_tls can be cancelled correctly * Make sure any error in SSLProtocol gets propagated (instead of just being logged) (cherry picked from commit 9602643120a509858d0bee4215d7f150e6125468) Co-authored-by: Yury Selivanov <yury@magic.io>
* Revert "bpo-22087: Fix Policy.get_event_loop() to detect fork (GH-7208)" ↵Yury Selivanov2018-05-291-7/+0
| | | | | (GH-7233) This reverts commit 2a7eb0b531656f4a77d85078e6e009e4b3639ef9.
* bpo-32751: Wait for task cancellation in asyncio.wait_for() (GH-7216)Miss Islington (bot)2018-05-291-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | Currently, asyncio.wait_for(fut), upon reaching the timeout deadline, cancels the future and returns immediately. This is problematic for when *fut* is a Task, because it will be left running for an arbitrary amount of time. This behavior is iself surprising and may lead to related bugs such as the one described in bpo-33638: condition = asyncio.Condition() async with condition: await asyncio.wait_for(condition.wait(), timeout=0.5) Currently, instead of raising a TimeoutError, the above code will fail with `RuntimeError: cannot wait on un-acquired lock`, because `__aexit__` is reached _before_ `condition.wait()` finishes its cancellation and re-acquires the condition lock. To resolve this, make `wait_for` await for the task cancellation. The tradeoff here is that the `timeout` promise may be broken if the task decides to handle its cancellation in a slow way. This represents a behavior change and should probably not be back-patched to 3.6 and earlier. (cherry picked from commit e2b340ab4196e1beb902327f503574b5d7369185) Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
* bpo-32684: Fix gather to propagate cancel of itself with return_exceptions ↵Miss Islington (bot)2018-05-291-1/+13
| | | | | | | (GH-7209) (#7222) (cherry picked from commit 863b6749093a86810c4077112a857363410cc221) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-22087: Fix Policy.get_event_loop() to detect fork (GH-7208)Miss Islington (bot)2018-05-291-0/+7
| | | | | | Original patch by Dan O'Reilly. (cherry picked from commit 5d97b7bcc19496617bf8c448d2f149cc28c73bc7) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-33353: test_asyncio use set_write_buffer_limits() (GH-7200)Miss Islington (bot)2018-05-291-1/+1
| | | | | | | | | | Use transport.set_write_buffer_limits() in sendfile tests of test_asyncio to make sure that the protocol is paused after sending 4 KiB. Previously, test_sendfile_fallback_close_peer_in_the_middle_of_receiving() failed on FreeBSD if the DATA was smaller than the default limit of 64 KiB. (cherry picked from commit 9551f7719213243fd96c4f284079243773c26b3c) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-33654: Support protocol type switching in SSLTransport.set_protocol() ↵Miss Islington (bot)2018-05-291-4/+7
| | | | | | | (GH-7194) (cherry picked from commit 2179022d94937d7b0600b0dc192ca6fa5f53d830) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-33674: Pause the transport as early as possible (GH-7192)Miss Islington (bot)2018-05-281-2/+5
| | | | | (cherry picked from commit f295587c45f96b62d24f9a12cef6931b0805f596) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-33674: asyncio: Fix SSLProtocol race (GH-7175) (#7187)Miss Islington (bot)2018-05-281-1/+1
| | | | | | | | | Fix a race condition in SSLProtocol.connection_made() of asyncio.sslproto: start immediately the handshake instead of using call_soon(). Previously, data_received() could be called before the handshake started, causing the handshake to hang or fail. (cherry picked from commit be00a5583a2cb696335c527b921d1868266a42c6) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-32410: Avoid blocking on file IO in sendfile fallback code (GH-7172) (#7182)Miss Islington (bot)2018-05-282-2/+9
| | | | | (cherry picked from commit 7165754b6b5f3b7c07050d921fa1c58bba5f0ff1) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-32610: Fix asyncio.all_tasks() to return only pending tasks. (GH-7174)Miss Islington (bot)2018-05-283-3/+16
| | | | | (cherry picked from commit 416c1ebd9896b394790dcb4f9f035b1a44ebe9ff) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-33469: RuntimeError after closing loop that used run_in_executor (GH-7171)Miss Islington (bot)2018-05-281-0/+3
| | | | | (cherry picked from commit fdccfe09f0b10776645fdb04a0783d6864c32b21) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-33672: Fix Task.__repr__ crash with Cython's bogus coroutines (GH-7161) ↵Miss Islington (bot)2018-05-282-40/+50
| | | | | | | (GH-7173) (cherry picked from commit 989b9e0e6d7dd2fa911f9bfd4744e7f3a82d6006) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-33654: Support BufferedProtocol in set_protocol() and start_tls() (GH-7130)Miss Islington (bot)2018-05-286-26/+107
| | | | | | | | | | | | | In this commit: * Support BufferedProtocol in set_protocol() and start_tls() * Fix proactor to cancel readers reliably * Update tests to be compatible with OpenSSL 1.1.1 * Clarify BufferedProtocol docs * Bump TLS tests timeouts to 60 seconds; eliminate possible race from start_serving * Rewrite test_start_tls_server_1 (cherry picked from commit dbf102271fcc316f353c7e0a283811b661d128f2) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-33505: Optimize asyncio.ensure_future by reordering if conditions ↵Miss Islington (bot)2018-05-281-5/+5
| | | | | | | (GH-6836) (#7162) (cherry picked from commit e549c4be5fb010f5faf12236af8faa720a1429be) Co-authored-by: jimmylai <albert_chs@yahoo.com.tw>
* bpo-31647: Fix write_eof() after close() for SelectorSocketTransport ↵Miss Islington (bot)2018-05-281-1/+1
| | | | | | | | | (GH-7149) (GH-7153) Fixed bug where calling write_eof() on a _SelectorSocketTransport after it's already closed raises AttributeError. (cherry picked from commit 23f587e395e41bd5e116312b036183f42bc4159b) Co-authored-by: twisteroid ambassador <twisteroidambassador@users.noreply.github.com>
* bpo-33263: Fix FD leak in _SelectorSocketTransport (GH-6450) (#7022)Miss Islington (bot)2018-05-211-3/+9
| | | | | | | | | | | * bpo-33263 Fix FD leak in _SelectorSocketTransport. (GH-6450) Under particular circumstances _SelectorSocketTransport can try to add a reader even the transport is already being closed. This can lead to FD leak and invalid stated of the following connections. Fixed the SelectorSocketTransport to add the reader only if the trasport is still active. (cherry picked from commit a84d0b361a26c05c6fadc6640591ec3feee5bfb5) Co-authored-by: Vlad Starostin <drtyrsa@yandex.ru>
* [3.7] bpo-32262: Fix typo in f-string (GH-7016)Miss Islington (bot)2018-05-201-1/+1
| | | | | | Fix typo from commit 6370f345e1d5829e1fba59cd695c8b82c5a8c620 (cherry picked from commit d361e99868a9eaa7ffce9341e1207705dbb66b50) Co-authored-by: Christian Heimes <christian@python.org>
* bpo-33584: Fix several minor bugs in asyncio. (GH-7003) (GH-7005)Miss Islington (bot)2018-05-201-1/+1
| | | | | | | | | | | | | | | Fix the following bugs in the C implementation: * get_future_loop() silenced all exceptions raised when look up the get_loop attribute, not just an AttributeError. * enter_task() silenced all exceptions raised when look up the current task, not just a KeyError. * repr() was called for a borrowed link in enter_task() and task_step_impl(). * str() was used instead of repr() in formatting one error message (in Python implementation too). * There where few reference leaks in error cases. (cherry picked from commit 6655354afcd116c27486bb5ba1dfa50b369d8d85) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-26819: Prevent proactor double read on resume (GH-6921)Miss Islington (bot)2018-05-201-1/+7
| | | | | | | | | | | | | The proactor event loop has a race condition when reading with pausing/resuming. `resume_reading()` unconditionally schedules the read function to read from the current future. If `resume_reading()` was called before the previously scheduled done callback fires, this results in two attempts to get the data from the most recent read and an assertion failure. This commit tracks whether or not `resume_reading` needs to reschedule the callback to restart the loop, preventing a second attempt to read the data. (cherry picked from commit 4151061855b571bf8a7579daa7875b8e243057b9) Co-authored-by: CtrlZvi <viz+github@flippedperspective.com>
* [3.7] Fix duplicating words words. (GH-6296) (GH-6297)Serhiy Storchaka2018-03-281-1/+1
| | | | | Most of them have been added in 3.7. (cherry picked from commit bac2d5ba30339298db7d4caa9c8cd31d807cf081)
* Fix senfile typo (GH-6265) (#6274)Miss Islington (bot)2018-03-271-1/+1
| | | | | | * Also in docs (cherry picked from commit 65a34709f60711f7c46031d4c6c420f567bc790a) Co-authored-by: Sam Dunster <me@sdunster.com>
* bpo-33037: Skip sending/receiving after SSL transport closing (GH-6044) ↵Miss Islington (bot)2018-03-101-1/+5
| | | | | | | | (GH-6057) * Skip write()/data_received() if sslpipe is destroyed (cherry picked from commit 5e80a71ab67045fecec46573a1892e240b569ace) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-32622: Native sendfile on windows (GH-5565)Miss Islington (bot)2018-02-252-1/+91
| | | | | | * Support sendfile on Windows Proactor event loop naively. (cherry picked from commit a19fb3c6aaa7632410d1d9dcb395d7101d124da4) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-32841: Fix cancellation in awaiting asyncio.Condition (GH-5665)Miss Islington (bot)2018-02-141-1/+5
| | | | | (cherry picked from commit 5746510b7aef423fa4afc92b2abb919307b1dbb9) Co-authored-by: Bar Harel <bzvi7919@gmail.com>
* bpo-32734: Fix asyncio.Lock multiple acquire safety issue (GH-5466) (#5501)Miss Islington (bot)2018-02-021-10/+22
| | | | | (cherry picked from commit 2f79c014931cbb23b08a7d16c534a3cc9607ae14) Co-authored-by: Bar Harel <bzvi7919@gmail.com>
* Implement TimerHandle.when() (GH-5473) (GH-5480)Miss Islington (bot)2018-02-011-0/+8
| | | | | (cherry picked from commit 3d4dbd8f019c0bbac99fc9248077044ff1039ca3) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-32251: Fix docs (#5408)Yury Selivanov2018-01-281-1/+1
|
* bpo-32251: Implement asyncio.BufferedProtocol. (#4755)Yury Selivanov2018-01-283-37/+241
|
* bpo-32327: Revert loop.run_in_executor behaviour: return a Future. (#5392)Yury Selivanov2018-01-281-2/+2
| | | | I've run some tests on 3.7 asyncio and it appears that too many things assume that run_in_executor returns a Future.
* bpo-32622: Normalize ENOTCONN to ConnectionError on macOS (GH-5369)Yury Selivanov2018-01-271-0/+11
| | | | On mac, sendfile throws ENOTCONN on a repeated sendfile call if the connection is closed. Normalize it to behave like other systems.
* bpo-32622: Enforce sendfile fallback policy for FALLBACK transports (#5364)Yury Selivanov2018-01-271-1/+6
|
* bpo-32622: Implement loop.sendfile() (#5271)Andrew Svetlov2018-01-277-4/+219
|
* bpo-31399: Let OpenSSL verify hostname and IP address (#3462)Christian Heimes2018-01-271-6/+0
| | | | | | | | | | | | | | | bpo-31399: Let OpenSSL verify hostname and IP The ssl module now uses OpenSSL's X509_VERIFY_PARAM_set1_host() and X509_VERIFY_PARAM_set1_ip() API to verify hostname and IP addresses. * Remove match_hostname calls * Check for libssl with set1_host, libssl must provide X509_VERIFY_PARAM_set1_host() * Add documentation for OpenSSL 1.0.2 requirement * Don't support OpenSSL special mode with a leading dot, e.g. ".example.org" matches "www.example.org". It's not standard conform. * Add hostname_checks_common_name Signed-off-by: Christian Heimes <christian@python.org>
* bpo-32574: Fix leaks in asyncio.Queue.put() and .get() (#5208)José Melero Fernández2018-01-251-2/+10
|
* bpo-32662: Implement Server.start_serving() and Server.serve_forever() (#5312)Yury Selivanov2018-01-253-30/+132
| | | | | | | | | | | | | * bpo-32662: Implement Server.start_serving() and Server.serve_forever() New methods: * Server.start_serving(), * Server.serve_forever(), and * Server.is_serving(). Add 'start_serving' keyword parameter to loop.create_server() and loop.create_unix_server().
* bpo-32391: Implement StreamWriter.wait_closed() (#5281)Andrew Svetlov2018-01-251-9/+27
|
* bpo-32636: Fix @asyncio.coroutine debug mode bug exposed by gh-5250 (#5291)Nathaniel J. Smith2018-01-241-1/+2
|
* bpo-32643: Drop support for a few private Task and Future APIs. (#5293)Yury Selivanov2018-01-242-18/+18
| | | | | | | | Specifically, it's not possible to subclass Task/Future classes and override the following methods: * Future._schedule_callbacks * Task._step * Task._wakeup
* bpo-32436: Implement PEP 567 (#5027)Yury Selivanov2018-01-227-36/+55
|
* bpo-32314: Fix asyncio.run() to cancel runinng tasks on shutdown (#5262)Yury Selivanov2018-01-212-15/+35
|
* bpo-32591: Add native coroutine origin tracking (#5250)Nathaniel J. Smith2018-01-212-66/+16
| | | | | | * Add coro.cr_origin and sys.set_coroutine_origin_tracking_depth * Use coroutine origin information in the unawaited coroutine warning * Stop using set_coroutine_wrapper in asyncio debug mode * In BaseEventLoop.set_debug, enable debugging in the correct thread