jimmylai
80bbe6a7b6
bpo-31350: Optimize get_event_loop and _get_running_loop ( #3347 )
...
* call remove_done_callback in finally section
* Optimize get_event_loop and _get_running_loop
* rename _loop_pid as loop_pid and add blurb news
* rename _loop_pid as loop_pid and add blurb news
* add back _RunningLoop
* Update 2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst
* Update 2017-09-05-10-30-48.bpo-31350.dXJ-7N.rst
2017-09-05 20:36:59 -04:00
Victor Stinner
16432beadb
bpo-31250, test_asyncio: fix dangling threads ( #3252 )
...
* Explicitly call shutdown(wait=True) on executors to wait until all
threads complete to prevent side effects between tests.
* Fix test_loop_self_reading_exception(): don't mock loop.close().
Previously, the original close() method was called rather than the
mock, because how set_event_loop() registered loop.close().
2017-09-01 14:46:06 +02:00
Victor Stinner
b903067462
bpo-30280: Cleanup threads in ayncio tests ( #2501 )
...
* bpo-30280: asyncio now cleans up threads
asyncio base TestCase now uses threading_setup() and
threading_cleanup() of test.support to cleanup threads.
* asyncio: Fix TestBaseSelectorEventLoop cleanup
bpo-30280: TestBaseSelectorEventLoop of
test.test_asyncio.test_selector_events now correctly closes the event
loop: cleanup its executor to not leak threads.
Don't override the close() method of the event loop, only override
the_close_self_pipe() method.
2017-06-30 11:12:33 +02:00
Johan de Jager
cab469245d
Fix a typo in a comment in coroutines.py (GH-2267)
...
defiend -> defined
2017-06-23 22:18:54 -07:00
Yury Selivanov
09663de203
Revert "bpo-29406: asyncio SSL contexts leak sockets after calling close with certain servers ( #409 )" ( #2111 )
...
This reverts commit a608d2d5a7
.
2017-06-11 16:46:35 +02:00
Yury Selivanov
7ce1c6fb57
bpo-30508: Don't log exceptions if Task/Future "cancel()" method called ( #2050 )
2017-06-11 13:49:18 +00:00
Nikolay Kim
a608d2d5a7
bpo-29406: asyncio SSL contexts leak sockets after calling close with certain servers ( #409 )
...
* asyncio SSL contexts leak sockets after calling close with certain servers
* cleanup _shutdown_timeout_handle on _fatal_error
2017-06-10 00:04:39 -04:00
Jim Fasarakis-Hilliard
34792d25ab
Fix TypeError is asyncio/proactor_events ( #993 )
2017-06-09 22:56:34 -04:00
Michaël Sghaïer
d1f575116a
Break circular references when closing SSLTransport objects ( #981 )
2017-06-09 18:29:46 -04:00
Nikolay Kim
a0e3d2dd09
Closing transport during handshake process leaks socket ( #480 )
2017-06-09 17:46:14 -04:00
Mathieu Sornay
894a654a9c
Fix waiter cancellation in asyncio.Lock ( #1031 )
...
Avoid a deadlock when the waiter who is about to take the lock is
cancelled
Issue #27585
2017-06-09 16:17:40 -04:00
jimmylai
21b3e04c13
call remove_done_callback in finally section ( #1688 )
2017-05-22 22:32:46 -07:00
INADA Naoki
991adca012
bpo-30048: asyncio: fix Task.cancel() was ignored. (GH-1097)
...
when there are no more `await` or `yield (from)` before return in coroutine,
cancel was ignored.
example:
async def coro():
asyncio.Task.current_task().cancel()
return 42
...
res = await coro() # should raise CancelledError
2017-05-11 21:18:38 +09:00
INADA Naoki
3e2ad8ec61
bpo-29617: Remove Python 3.3 support from asyncio (GH-232)
2017-04-25 10:57:18 +09:00
Serhiy Storchaka
2e576f5aec
bpo-30144: Import collections ABC from collections.abc rather than collections. ( #1263 )
2017-04-24 09:05:00 +03:00
Charles Renwick
ae5b3260dd
bpo-30098: Clarify that run_coroutine_threadsafe expects asyncio.Future (GH-1170)
2017-04-21 13:49:48 -07:00
Serhiy Storchaka
5affd23e6f
bpo-29762: More use "raise from None". ( #569 )
...
This hides unwanted implementation details from tracebacks.
2017-04-05 09:37:24 +03:00
Jim Fasarakis-Hilliard
1e73dbbc29
Fix small exception typos in Lib ( #818 )
2017-03-26 13:59:08 -07:00
Nikolay Kim
2b27e2e6a3
bpo-29742: asyncio get_extra_info() throws exception ( #525 )
2017-03-12 15:23:30 -04:00
Yury Selivanov
902e9c50e3
asyncio: Optimize _get_running_loop() to call getpid() only when there's a loop
2017-03-02 23:58:07 -05:00
Yury Selivanov
2f15645785
asyncio: Fix trailing whitespace/code style
2017-03-02 23:25:31 -05:00
Seth M. Larson
481cb70a72
bpo-29704: Fix asyncio.SubprocessStreamProtocol closing ( #405 )
2017-03-02 23:21:18 -05:00
Yury Selivanov
ba7e1f9a4e
bpo-29703: asyncio: Fix creating new event loops in child processes. ( #404 )
2017-03-02 20:07:11 -05:00
Mariatta Wijaya
189413dcfe
Issue #29314 : Merge with 3.6
2017-02-06 22:06:04 -08:00
Mariatta Wijaya
6138432e59
Issue #29314 : Merge with 3.5
2017-02-06 22:05:10 -08:00
Mariatta Wijaya
4e7ff8b1a3
Issue #29314 : Set the stacklevel to two in asyncio.async() Deprecation Warning
2017-02-06 22:03:00 -08:00
Serhiy Storchaka
70d28a184c
Remove unused imports.
2016-12-16 20:00:15 +02:00
Yury Selivanov
11c135136d
Merge 3.5 (issue #28990 )
2016-12-16 11:51:57 -05:00
Yury Selivanov
b1461aa781
Issue #28990 : Fix SSL hanging if connection is closed before handshake completed.
2016-12-16 11:50:41 -05:00
Yury Selivanov
5cb0c09fa6
Merge 3.5 (issue #28652 )
2016-11-21 17:47:41 -05:00
Yury Selivanov
dab0584738
Issue #28652 : Partially rollback previous changes
...
Allow AF_UNIX in create_server & create_connection
2016-11-21 17:47:27 -05:00
Yury Selivanov
21bb0e6f55
Merge 3.5 (issue #28704 )
2016-11-15 15:27:23 -05:00
Yury Selivanov
d7c151871e
Issue #28704 : Fix create_unix_server to support Path-like objects
2016-11-15 15:26:34 -05:00
Yury Selivanov
27182bb232
Merge 3.5 (issue #28703 )
2016-11-15 15:21:07 -05:00
Yury Selivanov
0ed20cdfb7
Issue #28703 : Fix asyncio.iscoroutinefunction to handle Mock objects.
2016-11-15 15:20:34 -05:00
Yury Selivanov
954c7dd0cc
Merge 3.5 (issue #28652 )
2016-11-09 15:47:47 -05:00
Yury Selivanov
a1a8b7d3d7
Issue #28652 : Make loop methods reject socket kinds they do not support.
2016-11-09 15:47:00 -05:00
Yury Selivanov
a054f40e84
Merge 3.5 (asyncio)
2016-11-08 19:16:15 -05:00
Yury Selivanov
6cc495e9e2
asyncio: Fix _format_coroutine for coroutine-like objects w/o __name__
...
Some built-in coroutine-like objects might not have __name__ or
__qualname__. A good example of such are 'asend', 'aclose' and
'athrow' coroutine methods of asynchronous generators.
2016-11-08 19:16:01 -05:00
Yury Selivanov
1994dd360b
Merge 3.5 (issue #28613 )
2016-11-07 19:01:14 -05:00
Yury Selivanov
6ea2b8fc8b
Issue #28613 : Expose asyncio._get_running_loop() and _set_running_loop()
2016-11-07 19:00:46 -05:00
Yury Selivanov
6130c0271f
Merge 3.5 (issue #28634 )
2016-11-07 16:07:30 -05:00
Yury Selivanov
49d6b8c0c3
Issue #28634 : Fix asyncio.isfuture() to support mocks
2016-11-07 16:00:50 -05:00
Yury Selivanov
69312fa4a2
Merge 3.5 (issue #28613 )
2016-11-04 14:30:11 -04:00
Yury Selivanov
600a349781
Issue #28613 : Fix get_event_loop() to return the current loop
...
when called from coroutines or callbacks.
2016-11-04 14:29:28 -04:00
Yury Selivanov
c5420492cf
asyncio: Sync with upstream
2016-11-03 15:35:23 -07:00
Yury Selivanov
a6fbcd19ac
Merge 3.5 (issue #28600 )
2016-11-03 15:10:11 -07:00
Yury Selivanov
491a912659
Issue #28600 : Optimize loop.call_soon().
...
Run expensive type checks only in debug mode. In addition, stop
supporting passing handles to loop.run_in_executor.
2016-11-03 15:09:24 -07:00
Yury Selivanov
a0c1ba608e
Issue #28544 : Implement asyncio.Task in C.
...
This implementation provides additional 10-20% speed boost for
asyncio programs.
The patch also fixes _asynciomodule.c to use Arguments Clinic, and
makes '_schedule_callbacks' an overridable method (as it was in 3.5).
2016-10-28 12:52:37 -04:00
Yury Selivanov
01c521ba7a
asyncio: Increase asyncio.Future test coverage; test both implementations.
...
Also, add 'isfuture' to 'asyncio.futures.__all__', so that it's
exposed as 'asyncio.isfuture'.
2016-10-23 22:34:35 -04:00
Yury Selivanov
6330f2a5ce
Merge 3.5 (issue #26796 )
2016-10-21 17:41:23 -04:00
Yury Selivanov
e8a6045fea
Issue #26796 : Don't configure the number of workers for default threadpool executor.
...
Initial patch by Hans Lawrenz.
2016-10-21 17:40:42 -04:00
Yury Selivanov
e145efcd7a
Merge 3.5 (issue #26923 )
2016-10-21 17:23:35 -04:00
Yury Selivanov
3d67615a48
Issue #26923 : Fix asyncio.Gather to refuse being cancelled once all children are done.
...
Patch by Johannes Ebke.
2016-10-21 17:22:17 -04:00
Yury Selivanov
ed0540698e
Issue #28500 : Fix asyncio to handle async gens GC from another thread.
2016-10-21 17:13:40 -04:00
INADA Naoki
a83636247e
Issue #28448 : Fix C implemented asyncio.Future didn't work on Windows
2016-10-21 12:30:15 +09:00
INADA Naoki
c411a7d821
Issue #28452 : Remove _asyncio._init_module function
2016-10-18 11:48:14 +09:00
INADA Naoki
9f2ce25481
Issue #28428 : Rename _futures module to _asyncio.
...
It will have more speedup functions or classes other than asyncio.Future.
2016-10-15 15:39:19 +09:00
Yury Selivanov
917c1c3ee1
Merge 3.5 (issue #27972 )
2016-10-09 12:20:44 -04:00
Yury Selivanov
4145c83806
Issue #27972 : Prohibit Tasks to await on themselves.
2016-10-09 12:19:12 -04:00
Yury Selivanov
88e8aca78d
Merge 3.5 (issue #28399 )
2016-10-09 12:16:08 -04:00
Yury Selivanov
908d55dd7e
Issue #28399 : Remove UNIX socket from FS before binding.
...
Patch by Коренберг Марк.
2016-10-09 12:15:08 -04:00
INADA Naoki
9e4e38ecd2
Issue #26801 : Added C implementation of asyncio.Future.
...
Original patch by Yury Selivanov.
2016-10-09 14:44:47 +09:00
Yury Selivanov
3df053e556
Merge 3.5 (asyncio)
2016-10-07 12:40:22 -04:00
Yury Selivanov
36e7e97d62
asyncio: Only allow Unix Stream sockets for loop.create_unix_server/connection
2016-10-07 12:39:57 -04:00
Yury Selivanov
a88614233e
Merge 3.5 (issue #23749 )
2016-10-05 19:40:19 -04:00
Yury Selivanov
92e7c7f99c
asyncio: Add "call_connection_made" arg to SSLProtocol.__init__
...
Issue #23749 : With this change it's possible to implement starttls
as a separate package on PyPI, or even by copying/pasting a small
snipped of code in your project.
It's expected that we'll figure out the API design for starttls
during 3.6, so that we can add it in 3.7.
2016-10-05 19:39:54 -04:00
Yury Selivanov
996dd4a666
Merge 3.5 (issue #28372 )
2016-10-05 19:33:36 -04:00
Yury Selivanov
8dc3e43839
Issue #28372 : Fix asyncio to support formatting of non-python coroutines
2016-10-05 19:32:49 -04:00
Yury Selivanov
d2c5fab7c6
Merge 3.5 (issue #28371 )
2016-10-05 18:29:04 -04:00
Yury Selivanov
0de3de6cbf
Issue #28371 : Deprecate passing asyncio.Handles to run_in_executor.
2016-10-05 18:28:09 -04:00
Yury Selivanov
139914a058
Merge 3.5 (issue #28370 )
2016-10-05 18:04:35 -04:00
Yury Selivanov
3e56ff0d08
Issue #28370 : Speedup asyncio.StreamReader.readexactly
...
Patch by Коренберг Марк.
2016-10-05 18:01:12 -04:00
Yury Selivanov
bb8eb92f46
Merge 3.5 (issue #28369 )
2016-10-05 17:49:54 -04:00
Yury Selivanov
5b8d4f97f8
Issue #28369 : Raise an error when transport's FD is used with add_reader
2016-10-05 17:48:59 -04:00
Yury Selivanov
67ea61818e
Merge 3.5 (issue #28368 )
2016-10-05 17:01:01 -04:00
Yury Selivanov
9eb6c67776
Issue #28368 : Refuse monitoring processes if the child watcher has no loop attached.
...
Patch by Vincent Michel.
2016-10-05 16:57:12 -04:00
Guido van Rossum
0035be3fee
Misc asyncio improvements from upstream (merge 3.5->3.6)
2016-09-30 08:18:34 -07:00
Guido van Rossum
e3c65a7a22
Misc asyncio improvements from upstream
2016-09-30 08:17:15 -07:00
Yury Selivanov
50fe7114ae
Merge 3.5 (issue #28176 )
2016-09-15 17:58:15 -04:00
Yury Selivanov
d6c6771fc9
Issue #28176 : Fix callbacks race in asyncio.SelectorLoop.sock_connect.
2016-09-15 17:56:36 -04:00
Yury Selivanov
b76968be0d
Merge 3.5 (asyncio, issue #26909 )
2016-09-15 16:52:41 -04:00
Yury Selivanov
4c5bf3bc52
Issue #26909 : Fix slow pipes IO in asyncio.
...
Patch by INADA Naoki.
2016-09-15 16:51:48 -04:00
Yury Selivanov
62b81c33d1
Merge 3.5 (issue #26654 )
2016-09-15 16:01:35 -04:00
Yury Selivanov
45dccdad93
Issue #26654 : Inspect functools.partial in asyncio.Handle.__repr__.
...
Patch by iceboy.
2016-09-15 15:58:15 -04:00
Yury Selivanov
1b984ffd44
Merge 3.5 (issue #28174 )
2016-09-15 15:46:16 -04:00
Yury Selivanov
5587d7c071
Issue #28174 : Handle when SO_REUSEPORT isn't properly supported (asyncio)
...
Patch by Seth Michael Larson.
2016-09-15 15:45:07 -04:00
Yury Selivanov
d070154fb5
Merge 3.5 (issue #27906 )
2016-09-15 14:14:48 -04:00
Yury Selivanov
a1b0e7db73
Issue #27906 : Fix socket accept exhaustion during high TCP traffic.
...
Patch by Kevin Conway.
2016-09-15 14:13:15 -04:00
Yury Selivanov
4357cf6202
Another asyncio sync.
2016-09-15 13:49:08 -04:00
Yury Selivanov
b26067a92f
asyncio: Drop debug code
2016-09-15 13:35:41 -04:00
Yury Selivanov
0a91d484a3
Merge 3.5 (asyncio)
2016-09-15 13:24:03 -04:00
Yury Selivanov
f6d991d885
asyncio: Sync with the upstream
2016-09-15 13:10:51 -04:00
Yury Selivanov
8987c9d219
Issue #26182 : Raise DeprecationWarning for improper use of async/await keywords
2016-09-15 12:50:23 -04:00
Yury Selivanov
503ba3ed97
Merge 3.5 (issue #27456 )
2016-09-11 21:44:17 -04:00
Yury Selivanov
44c19eccf9
Issue #27456 : asyncio: Set TCP_NODELAY by default.
2016-09-11 21:39:31 -04:00
Yury Selivanov
966321e236
Merge 3.5 (asyncio)
2016-09-11 21:11:19 -04:00
Yury Selivanov
a05a6ef1ca
asyncio: Add set_protocol / get_protocol methods to Transports
2016-09-11 21:11:02 -04:00
Christian Heimes
d04863771b
Issue #28022 : Deprecate ssl-related arguments in favor of SSLContext.
...
The deprecation include manual creation of SSLSocket and certfile/keyfile
(or similar) in ftplib, httplib, imaplib, smtplib, poplib and urllib.
ssl.wrap_socket() is not marked as deprecated yet.
2016-09-10 23:23:33 +02:00
Raymond Hettinger
f1024f7425
merge
2016-09-09 15:58:00 -07:00
Guido van Rossum
7b3b3dc85d
Merge asyncio upstream.
2016-09-09 14:26:31 -07:00
Guido van Rossum
7719d46431
Rename Future._blocking to _asyncio_future_blocking.
...
This is now an official "protected" API that can be used to write
classes that are duck-type-compatible with Future without subclassing
it. (For that purpose I also changed isinstance(result, Future) to
check for this attribute instead.)
Hopefully Amber Brown can use this to make Twisted.Deferred compatible
with asyncio.Future.
Tests and docs are TBD. (Also there are more isinstance() checks to fix.)
2016-09-09 12:58:15 -07:00
Guido van Rossum
1140a03426
Rename Future._blocking to _asyncio_future_blocking.
...
This is now an official "protected" API that can be used to write
classes that are duck-type-compatible with Future without subclassing
it. (For that purpose I also changed isinstance(result, Future) to
check for this attribute instead.)
Hopefully Amber Brown can use this to make Twisted.Deferred compatible
with asyncio.Future.
Tests and docs are TBD.
2016-09-09 12:54:54 -07:00
Yury Selivanov
eb6364557f
Issue #28003 : Implement PEP 525 -- Asynchronous Generators.
2016-09-08 22:01:51 -07:00
Martin Panter
0be894b2f6
Issue #27895 : Spelling fixes (Contributed by Ville Skyttä).
2016-09-07 12:03:06 +00:00
Guido van Rossum
4786787c07
Fix ordering issues in UNIX read/write pipe transport constructors.
...
Upstream https://github.com/python/asyncio/pull/408 by Ron Frederick.
2016-08-31 09:42:38 -07:00
Guido van Rossum
8b7918a7e2
Don't select for read on character devices in _UnixWritePipeTransport.
...
Upstream https://github.com/python/asyncio/pull/374 by Ron Frederick.
2016-08-31 09:40:18 -07:00
Guido van Rossum
898ac56fc2
Merge asyncio from 3.5
2016-08-31 09:47:08 -07:00
Vinay Sajip
dd917f84e3
Closes #27904 : Improved logging statements to defer formatting until needed.
2016-08-31 08:22:29 +01:00
Raymond Hettinger
15f44ab043
Issue #27895 : Spelling fixes (Contributed by Ville Skyttä).
2016-08-30 10:47:49 -07:00
Guido van Rossum
83f5a3846c
In asyncio.locks.Lock.acquire(): Avoid deadlock when a cancelled future is in self._waiters.
2016-08-23 09:39:03 -07:00
Guido van Rossum
f06c7b6f37
In asyncio.locks.Lock.acquire(): Avoid deadlock when a cancelled future is in self._waiters. (Merge 3.5->3.6)
2016-08-23 09:39:26 -07:00
Yury Selivanov
e824315e2b
Merge 3.5 (issue #27392 )
2016-07-12 18:24:25 -04:00
Yury Selivanov
252e9ed974
Issue #27392 : Add loop.connect_accepted_socket().
...
Patch by Jim Fulton.
2016-07-12 18:23:10 -04:00
Yury Selivanov
5eef78b113
Merge 3.5 (asyncio)
2016-06-28 11:00:39 -04:00
Yury Selivanov
63bf487688
asyncio: Use socket specs for getaddrinfo() in sock_connect()
...
Patch by Martin Richard. GH PR #365 .
2016-06-28 11:00:22 -04:00
Yury Selivanov
7c6b3ea48c
Merge 3.5 (asyncio)
2016-06-28 10:55:49 -04:00
Yury Selivanov
77bc04a3bc
asyncio: Fix NameError in sslproto _fatal_error()
...
Patch by Richard Walker.
2016-06-28 10:55:36 -04:00
Yury Selivanov
d35bf03284
Merge 3.5 (issue #22970 )
2016-06-11 12:01:19 -04:00
Yury Selivanov
c92bf83a82
Issue #22970 : asyncio: Fix inconsistency cancelling Condition.wait.
...
Patch by David Coles.
2016-06-11 12:00:07 -04:00
Yury Selivanov
6588712bf0
Merge 3.5 (issue #27223 )
2016-06-11 11:20:50 -04:00
Yury Selivanov
ca2e0a48cf
Issue #27223 : aio: Fix _read_ready and _write_ready to respect _conn_lost.
...
Patch by Łukasz Langa.
2016-06-11 11:19:47 -04:00
Yury Selivanov
711d25db48
Merge 3.5 (issue #27243 )
2016-06-09 15:13:16 -04:00
Yury Selivanov
a6f6edbda8
Issue #27243 : Fix __aiter__ protocol
2016-06-09 15:08:31 -04:00
Yury Selivanov
7a713386d8
Merge 3.5 (asyncio)
2016-06-08 13:57:23 -04:00
Yury Selivanov
c1cf296de6
asyncio: Remove asyncio.timeout() context manager.
...
It will probably be added back in Python 3.6, once its compatibility
issues are resolved; see [1] for more details.
[1] https://mail.python.org/pipermail/async-sig/2016-June/000045.html
2016-06-08 13:57:03 -04:00
Yury Selivanov
552bf94648
Merge 3.5 (issue #27136 , asyncio)
2016-06-08 12:33:59 -04:00
Yury Selivanov
f1c6fa9866
Issue #27136 : Fix DNS static resolution; don't use it in getaddrinfo
...
Patch by A. Jesse Jiryu Davis
2016-06-08 12:33:31 -04:00
Martin Panter
19409197e2
Merge typo fixes from 3.5
2016-06-04 05:26:40 +00:00
Martin Panter
3ee6270262
Fix typos in code comment and documentation
2016-06-04 04:57:19 +00:00
Yury Selivanov
1f56e5f6af
Merge 3.5 (asyncio)
2016-06-02 16:51:27 -04:00
Yury Selivanov
a714616d36
asyncio: Fix getaddrinfo to accept service names (for port)
...
Patch by A. Jesse Jiryu Davis
2016-06-02 16:51:07 -04:00
Yury Selivanov
642afb3d3d
Merge 3.5 (asyncio)
2016-06-02 16:44:10 -04:00
Yury Selivanov
a8f895f051
asyncio: Support host=b'' for getaddrinfo
2016-06-02 16:43:52 -04:00
Martin Panter
3e04d5b306
Issue #27076 : Merge spelling from 3.5
2016-05-26 06:03:19 +00:00
Martin Panter
46f50726a0
Issue #27076 : Doc, comment and tests spelling fixes
...
Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
2016-05-26 05:35:26 +00:00
Yury Selivanov
72005f1744
Merge 3.5 (asyncio)
2016-05-21 16:50:31 -04:00
Yury Selivanov
f0200e06f0
asyncio: Fix BytesWarning (use typed=True in lru_cache for _ipaddr_info)
2016-05-21 16:50:16 -04:00
Yury Selivanov
010f361dad
Merge 3.5 (asyncio)
2016-05-20 17:44:44 -04:00
Yury Selivanov
eaaaee8c56
asyncio: Fix getaddrinfo to accept None/str/bytes for 'port' arg
...
Patch by A. Jesse Jiryu Davis.
2016-05-20 17:44:19 -04:00
Yury Selivanov
f4049ee170
Merge 3.5 (asyncio)
2016-05-20 11:31:55 -04:00
Yury Selivanov
3dc5129d4f
asyncio: Fix an SSL warning in StreamReaderProtocol.eof_received
2016-05-20 11:31:40 -04:00
Victor Stinner
2292edf574
Merge 3.5 (issue #26741 )
2016-05-20 13:06:55 +02:00
Victor Stinner
b0d43ce890
asyncio: fix ResourceWarning related to subprocesses
...
Issue #26741 : asyncio: BaseSubprocessTransport._process_exited() now copies the
return code from the child watched to the returncode attribute of the Popen
object. On Python 3.6, it is required to avoid a ResourceWarning.
2016-05-20 13:05:48 +02:00
Yury Selivanov
63063af12e
Merge 3.5 (asyncio)
2016-05-16 16:32:56 -04:00
Yury Selivanov
b461791b91
asyncio/streams: Fix code style; delete LimitOverrunError.message attr
2016-05-16 16:32:38 -04:00
Yury Selivanov
8ace2c66d3
Merge 3.5 (Issue #27041 )
2016-05-16 15:39:39 -04:00
Yury Selivanov
7661db6228
Issue #27041 : asyncio: Add loop.create_future method
2016-05-16 15:38:39 -04:00
Yury Selivanov
7c3ac2d1f8
Merge 3.5 (issue #27040 )
2016-05-16 15:32:26 -04:00
Yury Selivanov
7ed7ce6ee7
Issue #27040 : Add loop.get_exception_handler method
2016-05-16 15:20:38 -04:00
Yury Selivanov
2e413f7cc7
Merge 3.5 (asyncio)
2016-05-13 16:05:05 -04:00
Yury Selivanov
5dc093336f
asyncio: Fix unix pipe transport 'repr' methods
...
Patch by Vincent Michel.
See also https://github.com/python/asyncio/pull/326
2016-05-13 16:04:43 -04:00
Yury Selivanov
8308db5cd5
Merge 3.5 (asyncio)
2016-05-13 15:59:48 -04:00
Yury Selivanov
32dae3d50f
asyncio: Break reference cycle in StreamReaderProtocol.connection_lost
2016-05-13 15:58:00 -04:00
Yury Selivanov
059320bab8
Merge 3.5 (issue #26848 )
2016-05-13 15:39:09 -04:00
Yury Selivanov
7657f6ba21
Issue #26848 : Fix asyncio/subprocess.communicate() to handle empty input.
2016-05-13 15:35:28 -04:00
Serhiy Storchaka
b6a9c9761c
Issue #26778 : Fixed "a/an/and" typos in code comment, documentation and error
...
messages.
2016-04-17 09:39:28 +03:00
Serhiy Storchaka
6a7b3a77b4
Issue #26778 : Fixed "a/an/and" typos in code comment and documentation.
2016-04-17 08:32:47 +03:00
Martin Panter
cda80940ed
Issue #15984 : Merge PyUnicode doc from 3.5
2016-04-15 02:27:11 +00:00
Martin Panter
6245cb3c01
Correct “an” → “a” with “Unicode”, “user”, “UTF”, etc
...
This affects documentation, code comments, and a debugging messages.
2016-04-15 02:14:19 +00:00
Victor Stinner
00f4648a39
Merge 3.5 (asyncio)
2016-04-01 21:43:54 +02:00
Victor Stinner
c94a93aecb
asyncio: Don't log ConnectionAbortedError
...
Issue #26509 : In fatal error handlers, don't log ConnectionAbortedError which
occur on Windows.
2016-04-01 21:43:39 +02:00
Victor Stinner
89d3f53aac
Merge 3.5 (asyncio)
2016-04-01 21:40:14 +02:00
Victor Stinner
2ba8ece5be
asyncio: allow None as wait timeout
...
Fix GH#325: Allow to pass None as a timeout value to disable timeout logic.
Change written by Andrew Svetlov and merged by Guido van Rossum.
2016-04-01 21:39:09 +02:00
Victor Stinner
e19558af1b
Add a source parameter to warnings.warn()
...
Issue #26604 :
* Add a new optional source parameter to _warnings.warn() and warnings.warn()
* Modify asyncore, asyncio and _pyio modules to set the source parameter when
logging a ResourceWarning warning
2016-03-23 00:28:08 +01:00
Yury Selivanov
e076ffb068
asyncio: Remove duplicate bind addresses in create_server.
...
Patch by Sebastien Bourdeauducq (issue #26338 )
2016-03-02 11:17:01 -05:00
Yury Selivanov
1bd030788d
asyncio: Prevent StopIteration from being thrown into a Future
...
Patch by Chris Angelico (issue #26221 )
2016-03-02 11:03:28 -05:00
Yury Selivanov
dce63234c5
asyncio: Fix @coroutine to recognize CoroWrapper (issue #25647 )
...
Patch by Vladimir Rutsky.
2016-03-02 10:49:16 -05:00
Martin Panter
c04fb56e36
Issue #26304 : Change "allows to <verb>" to "allows <verb>ing" or similar
...
The original form is incorrect grammar and feels awkward, even though the
meaning is clear.
2016-02-10 05:44:01 +00:00
Victor Stinner
3e7230904e
Fix error message in asyncio.selector_events.
...
Patch written by Carlo Beccarini <hackdiablo.cb@gmail.com>.
2016-02-01 12:46:38 +01:00
Yury Selivanov
d9d0e864b9
Issue #26050 : Add asyncio.StreamReader.readuntil() method.
...
Patch by Марк Коренберг.
2016-01-11 12:28:19 -05:00
Andrew Svetlov
9d976fa75f
Sync with asyncio
2016-01-11 12:25:23 +02:00
Andrew Svetlov
c07b16b40f
Sync with asyncio repo
2016-01-11 08:42:49 +02:00
Yury Selivanov
d5c2a62100
asyncio: Skip getaddrinfo if host is already resolved.
...
getaddrinfo takes an exclusive lock on some platforms, causing clients to queue
up waiting for the lock if many names are being resolved concurrently. Users
may want to handle name resolution in their own code, for the sake of caching,
using an alternate resolver, or to measure DNS duration separately from
connection duration. Skip getaddrinfo if the "host" passed into
create_connection is already resolved.
See https://github.com/python/asyncio/pull/302 for details.
Patch by A. Jesse Jiryu Davis.
2015-12-16 19:31:17 -05:00
Yury Selivanov
0ac3a0cd79
asyncio: Make Tasks check if Futures are attached to the same event loop
...
See https://github.com/python/asyncio/pull/303 for details
2015-12-11 11:33:59 -05:00
Yury Selivanov
dddc781998
asyncio: Sync with github
2015-12-11 11:32:59 -05:00
Yury Selivanov
0f3c9765d4
asyncio: Fix with github
...
See https://github.com/python/asyncio/pull/295 for details
2015-11-20 12:57:34 -05:00
Yury Selivanov
d59bba88e3
asyncio: Drop "value" parameter from Task._step method.
2015-11-20 12:41:03 -05:00
Guido van Rossum
41f69f4cc7
Issue #25593 : Change semantics of EventLoop.stop().
2015-11-19 13:28:47 -08:00
Yury Selivanov
b3dd6d70c7
asyncio: Error if awaiting in parallel on the same coroutine
...
This change won't do anything in CPython 3.4
See https://github.com/python/asyncio/pull/293 for details.
2015-11-18 12:39:45 -05:00
Yury Selivanov
5d7e3b6cd2
asyncio: Cleanup Future API
...
See https://github.com/python/asyncio/pull/292 for details.
2015-11-17 12:19:41 -05:00
Yury Selivanov
0013ccedd1
asyncio: Sync with github
2015-11-17 12:02:21 -05:00
Yury Selivanov
a4afc4876b
asyncio: Optimize Task._wakeup
...
See https://github.com/python/asyncio/pull/289 for details.
2015-11-16 15:12:10 -05:00
Yury Selivanov
5bb1afb332
asyncio: Add Transport.is_closing()
...
See https://github.com/python/asyncio/pull/291 for details.
2015-11-16 12:43:21 -05:00
Yury Selivanov
ade0412613
asyncio: Optimize asyncio.sleep(0)
2015-11-05 14:29:04 -05:00
Serhiy Storchaka
d65c9496da
Issue #25523 : Further a-to-an corrections.
2015-11-02 14:10:23 +02:00
Martin Panter
7462b64911
Issue #25523 : Correct "a" article to "an" article
...
This changes the main documentation, doc strings, source code comments, and a
couple error messages in the test suite. In some cases the word was removed
or edited some other way to fix the grammar.
2015-11-02 03:37:02 +00:00
Guido van Rossum
c44ecdf687
Issue #25441 : asyncio: Raise error from drain() when socket is closed.
2015-10-19 11:49:30 -07:00
Guido van Rossum
601953b679
Docs and one small improvement for issue #25304 , by Vincent Michel.
2015-10-05 16:20:00 -07:00
Guido van Rossum
b9bf913ab3
Issue #23972 : updates to asyncio datagram API. By Chris Laws.
2015-10-05 09:15:28 -07:00
Guido van Rossum
841d9ee41a
Issue #25304 : Add asyncio.run_coroutine_threadsafe(). By Vincent Michel.
2015-10-03 08:31:42 -07:00
Yury Selivanov
620279b9ac
asyncio: ensure_future() now understands awaitables
2015-10-02 15:00:19 -04:00
Guido van Rossum
d455a50773
Also rewrote the guts of asyncio.Semaphore (patch by manipopopo).
2015-09-29 11:54:45 -07:00
Andrew Svetlov
d94c1b92ed
Fix StreamReader.__repr__
2015-09-29 18:36:00 +03:00
Guido van Rossum
99f96c5451
Issue #25233 : Rewrite the guts of Queue to be more understandable and correct.
2015-09-28 07:42:34 -07:00
Victor Stinner
5e4a7d8dc7
Issue #23630 , asyncio: host parameter of loop.create_server() can now be a
...
sequence of strings. Patch written by Yann Sionneau.
2015-09-21 18:33:43 +02:00
Victor Stinner
f7dc7fb74d
Issue #25114 , asyncio: add ssl_object extra info to SSL transports
...
This info is required on Python 3.5 and newer to get specific information on
the SSL object, like getting the binary peer certificate (instead of getting
it as text).
2015-09-21 18:06:17 +02:00
Yury Selivanov
233983380d
Issue #24867 : Fix Task.get_stack() for 'async def' coroutines
2015-08-14 15:30:59 -04:00
Yury Selivanov
159fbdd805
Issue #23812 : Fix getter-cancellation with many pending getters code path
2015-08-06 14:03:38 -04:00
Yury Selivanov
8c125eb44b
asyncio: Make sure BaseException is re-raised in SSLProtocol
2015-08-05 14:06:23 -04:00
Yury Selivanov
3fc0f2d288
Issue #23812 : Fix asyncio.Queue.get() to avoid loosing items on cancellation.
...
Patch by Gustavo J. A. M. Carneiro.
2015-08-05 13:52:33 -04:00
Yury Selivanov
2a8911c0b7
asyncio: Sync with upstream (compat module)
2015-08-04 15:56:33 -04:00
Yury Selivanov
996083d6e6
asyncio: Sync with mainstream
2015-08-04 15:37:24 -04:00
Yury Selivanov
4c0a09a0c9
Revert da29a94367b2
2015-08-02 16:49:31 -04:00
Yury Selivanov
6b3f29ca8f
asyncio: Fix code style
2015-08-02 10:24:34 -04:00
Victor Stinner
6fb1e740c6
Fix ResourceWarning in asyncio.BaseSubprocessTransport
...
Issue #24763 : Fix resource warnings when asyncio.BaseSubprocessTransport
constructor fails, if subprocess.Popen raises an exception for example.
Patch written by Martin Richard, test written by me.
2015-07-31 17:49:43 +02:00
Victor Stinner
eaf16abc68
asyncio: sync with github
...
* Fix ResourceWarning warnings in test_streams
* Return True from StreamReader.eof_received() to fix
http://bugs.python.org/issue24539 (but still needs a unittest).
Add StreamReader.__repr__() for easy debugging.
* remove unused imports
* Issue #234 : Drop JoinableQueue on Python 3.5+
2015-07-25 02:40:40 +02:00
Victor Stinner
71080fc351
asyncio: Add asyncio.compat module
...
Move compatibility helpers for the different Python versions to a new
asyncio.compat module.
2015-07-25 02:23:21 +02:00
Victor Stinner
e6ecea53c8
asyncio: sync with github asyncio
...
* queues: get coroutine from asyncio.coroutines, not from asyncio.tasks
* tets: replace tulip with asyncio in comments
2015-07-09 23:13:50 +02:00
Yury Selivanov
09e6058838
Issue #24450 : Proxy gi_yieldfrom & cr_await in asyncio.CoroWrapper
2015-07-03 00:41:16 -04:00
Yury Selivanov
339d5e7d85
Fix asyncio unittests in debug mode
2015-06-24 10:45:44 -04:00
Yury Selivanov
29a602a140
Issue #24400 : Fix CoroWrapper for 'async def' coroutines
2015-06-24 10:30:14 -04:00
Yury Selivanov
dfbd27f0be
asyncio: Merge changes from issue #24400 .
2015-06-24 09:41:35 -04:00
Yury Selivanov
70adad2a0e
Issue 24017: Fix asyncio.CoroWrapper to support 'async def' coroutines
2015-05-31 21:37:09 -04:00
Yury Selivanov
a316085192
Issue 24004: Support Awaitables (pep 492) in @asyncio.coroutine decorator
2015-05-30 21:02:12 -04:00
Yury Selivanov
1ad08a5555
asyncio: Drop some useless code from tasks.py.
...
See also issue 24017.
2015-05-28 10:52:19 -04:00
Yury Selivanov
c58cca5951
asyncio: Use 'collections.abc.Coroutine' in asyncio.iscoroutine (in 3.5)
2015-05-13 15:21:41 -04:00
Yury Selivanov
d08c363c26
Sync asyncio code from default branch.
2015-05-13 15:15:56 -04:00
Yury Selivanov
e8944cb217
asyncio: Make sure sys.set_coroutine_wrapper is called *only* when loop is running.
...
Previous approach of installing coroutine wrapper in loop.set_debug() and
uninstalling it in loop.close() was very fragile. Most of asyncio tests
do not call loop.close() at all. Since coroutine wrapper is a global
setting, we have to make sure that it's only set when the loop is
running, and is automatically unset when it stops running.
Issue #24017 .
2015-05-12 11:43:04 -04:00
Yury Selivanov
1af2bf75a2
asyncio: Support PEP 492. Issue #24017 .
2015-05-11 22:27:25 -04:00
Yury Selivanov
59eb9a4da5
asyncio: async() function is deprecated in favour of ensure_future().
2015-05-11 14:48:38 -04:00
Yury Selivanov
740169cd24
Sync asyncio changes from the main repo.
2015-05-11 14:23:38 -04:00
Guido van Rossum
0a9933ebf3
Asyncio issue 222 / PR 231 (Victor Stinner) -- fix @coroutine functions without __name__.
2015-05-02 18:38:24 -07:00
Guido van Rossum
0bd16bc4cd
Fix asyncio issue 235: Queue subclass bug caused by JoinableQueue merge.
2015-04-20 09:24:24 -07:00
Victor Stinner
c9d11c341e
Issue #23879 , asyncio: SelectorEventLoop.sock_connect() must not call connect()
...
again if the first call to connect() raises an InterruptedError.
When the C function connect() fails with EINTR, the connection runs in
background. We have to wait until the socket becomes writable to be notified
when the connection succeed or fails.
2015-04-07 21:38:04 +02:00
Victor Stinner
79fd962652
asyncio: Fix _SelectorTransport.__repr__() if the event loop is closed
2015-03-27 15:20:08 +01:00
Victor Stinner
d6dc7bdaf9
Issue #23456 : Add missing @coroutine decorators in asyncio
2015-03-18 11:37:42 +01:00
Victor Stinner
7a82afee70
asyncio: Fix repr(BaseSubprocessTransport) if it didn't start yet
...
Replace "running" with "not started" and don't show the pid if the subprocess
didn't start yet.
2015-03-10 16:32:29 +01:00
Victor Stinner
ce8c7682d6
Issue #23537 : Remove 2 unused private methods of asyncio.BaseSubprocessTransport
...
Methods only raise NotImplementedError and are never used.
2015-02-27 17:49:09 +01:00
Victor Stinner
4cb814c7e1
asyncio, Tulip issue 220: Merge JoinableQueue with Queue.
...
Merge JoinableQueue with Queue. To more closely match the standard Queue,
asyncio.Queue has "join" and "task_done". JoinableQueue is deleted.
Docstring for Queue.join shouldn't mention threads.
Restore JoinableQueue as a deprecated alias for Queue. To more closely match
the standard Queue, asyncio.Queue has "join" and "task_done". JoinableQueue
remains as a deprecated alias for Queue to avoid needlessly breaking too much
code that depended on it.
Patch written by A. Jesse Jiryu Davis <jesse@mongodb.com>.
2015-02-17 22:53:28 +01:00
Victor Stinner
4e82fb99a0
asyncio: BaseSubprocessTransport: repr() mentions when the child process is
...
running
2015-02-17 22:50:33 +01:00
Victor Stinner
8e36812e27
asyncio: BaseSubprocessTransport.close() doesn't try to kill the process if it
...
already finished
2015-02-10 14:49:32 +01:00
Victor Stinner
a87501fd23
asyncio: BaseEventLoop: rename _owner to _thread_id
2015-02-05 11:45:33 +01:00
Victor Stinner
2fc2313038
asyncio: Only call _check_resolved_address() in debug mode
...
* _check_resolved_address() is implemented with getaddrinfo() which is slow
* If available, use socket.inet_pton() instead of socket.getaddrinfo(), because
it is much faster
Microbenchmark (timeit) on Fedora 21 (Python 3.4, Linux 3.17, glibc 2.20) to
validate the IPV4 address "127.0.0.1" or the IPv6 address "::1":
* getaddrinfo() 10.4 usec per loop
* inet_pton(): 0.285 usec per loop
On glibc older than 2.14, getaddrinfo() always requests the list of all local
IP addresses to the kernel (using a NETLINK socket). getaddrinfo() has other
known issues, it's better to avoid it when it is possible.
2015-02-04 14:51:23 +01:00
Victor Stinner
aa41b9b22b
asyncio: BaseSelectorEventLoop uses directly the private _debug attribute
...
Just try to be consistent: _debug was already used in some places, and always
used in BaseProactorEventLoop.
2015-02-04 14:50:59 +01:00
Victor Stinner
17d87f8ae4
asyncio, Tulip issue 221: Fix doc of QueueEmpty and QueueFull
2015-02-03 15:09:24 +01:00
Victor Stinner
5d44c08f1c
Issue #23353 , asyncio: Workaround CPython bug #23353
...
Don't use yield/yield-from in an except block of a generator. Store the
exception and handle it outside the except block.
2015-02-02 18:36:31 +01:00
Victor Stinner
f2e43cbbd4
Issue #23347 , asyncio: send_signal(), terminate(), kill() don't check if the
...
transport was closed. The check broken a Tulip example and this limitation is
arbitrary. Check if _proc is None should be enough.
Enhance also close(): do nothing when called the second time.
2015-01-30 01:20:44 +01:00
Victor Stinner
1241ecc21b
Issue #23347 , asyncio: Make BaseSubprocessTransport.wait() private
2015-01-30 00:16:14 +01:00
Victor Stinner
47cd10d7a9
asyncio: sync with Tulip
...
Issue #23347 : send_signal(), kill() and terminate() methods of
BaseSubprocessTransport now check if the transport was closed and if the
process exited.
Issue #23347 : Refactor creation of subprocess transports. Changes on
BaseSubprocessTransport:
* Add a wait() method to wait until the child process exit
* The constructor now accepts an optional waiter parameter. The _post_init()
coroutine must not be called explicitly anymore. It makes subprocess
transports closer to other transports, and it gives more freedom if we want
later to change completly how subprocess transports are created.
* close() now kills the process instead of kindly terminate it: the child
process may ignore SIGTERM and continue to run. Call explicitly terminate()
and wait() if you want to kindly terminate the child process.
* close() now logs a warning in debug mode if the process is still running and
needs to be killed
* _make_subprocess_transport() is now fully asynchronous again: if the creation
of the transport failed, wait asynchronously for the process eixt. Before the
wait was synchronous. This change requires close() to *kill*, and not
terminate, the child process.
* Remove the _kill_wait() method, replaced with a more agressive close()
method. It fixes _make_subprocess_transport() on error.
BaseSubprocessTransport.close() calls the close() method of pipe transports,
whereas _kill_wait() closed directly pipes of the subprocess.Popen object
without unregistering file descriptors from the selector (which caused severe
bugs).
These changes simplifies the code of subprocess.py.
2015-01-30 00:05:19 +01:00
Victor Stinner
978a9afc6a
Issue #23243 , asyncio: Emit a ResourceWarning when an event loop or a transport
...
is not explicitly closed. Close also explicitly transports in test_sslproto.
2015-01-29 17:50:58 +01:00
Victor Stinner
2934262fd3
asyncio: sync with Tulip
...
* Cleanup gather(): use cancelled() method instead of using private Future
attribute
* Fix _UnixReadPipeTransport and _UnixWritePipeTransport. Only start reading
when connection_made() has been called.
* Issue #23333 : Fix BaseSelectorEventLoop._accept_connection(). Close the
transport on error. In debug mode, log errors using call_exception_handler()
2015-01-29 14:15:19 +01:00
Victor Stinner
54a231d539
asyncio doc: document Protocol state machine
2015-01-29 13:33:15 +01:00
Victor Stinner
47bbea7124
asyncio: sync with Tulip
...
* _SelectorTransport constructor: extra parameter is now optional
* Fix _SelectorDatagramTransport constructor. Only start reading after
connection_made() has been called.
* Fix _SelectorSslTransport.close(). Don't call protocol.connection_lost() if
protocol.connection_made() was not called yet: if the SSL handshake failed or
is still in progress. The close() method can be called if the creation of the
connection is cancelled, by a timeout for example.
2015-01-29 02:56:05 +01:00
Victor Stinner
7b5a900e88
asyncio: BaseSubprocessTransport._kill_wait() now also call close()
...
close() closes pipes, which is not None yet by _kill_wait().
2015-01-29 02:14:30 +01:00
Victor Stinner
fa73779b0a
asyncio: Fix _SelectorSocketTransport constructor
...
Only start reading when connection_made() has been called:
protocol.data_received() must not be called before protocol.connection_made().
2015-01-29 00:36:51 +01:00
Victor Stinner
f07801bb17
asyncio: SSL transports now clear their reference to the waiter
...
* Rephrase also the comment explaining why the waiter is not awaken immediatly.
* SSLProtocol.eof_received() doesn't instanciate ConnectionResetError exception
directly, it will be done by Future.set_exception(). The exception is not
used if the waiter was cancelled or if there is no waiter.
2015-01-29 00:36:35 +01:00
Victor Stinner
b507cbaac5
asyncio: Fix SSLProtocol.eof_received()
...
Wake-up the waiter if it is not done yet.
2015-01-29 00:35:56 +01:00
Victor Stinner
ff018e406c
asyncio: sync with Tulip
...
* Remove unused SSLProtocol._closing attribute
* test_sslproto: skip test if ssl module is missing
* Python issue #23208 : Don't use the traceback of the current handle if we
already know the traceback of the source. The handle may be more revelant,
but having 3 tracebacks (handle, source, exception) becomes more difficult to
read. The handle may be preferred later but it requires more work to make
this choice.
2015-01-28 00:30:40 +01:00
Victor Stinner
41063d2a59
asyncio, Tulip issue 204: Fix IocpProactor.recv()
...
If ReadFile() fails with ERROR_BROKEN_PIPE, the operation is not pending: don't
register the overlapped.
I don't know if WSARecv() can fail with ERROR_BROKEN_PIPE. Since
Overlapped.WSARecv() already handled ERROR_BROKEN_PIPE, let me guess that it
has the same behaviour than ReadFile().
2015-01-26 22:30:49 +01:00