Commit graph

632 commits

Author SHA1 Message Date
Victor Stinner ac577d7d0b
bpo-32154: Remove asyncio.windows_utils.socketpair (#4609) 2017-11-28 21:33:20 +01:00
Victor Stinner 4271dfd781
bpo-32154: Remove asyncio.selectors (#4605)
* Remove asyncio.selectors and asyncio._overlapped symbols from the
  namespace of the asyncio module
* Replace "from asyncio import selectors" with "import selectors"
* Replace "from asyncio import _overlapped" with "import _overlapped"

asyncio.selectors was added to support Python 3.3, which doesn't have
selectors in its standard library, and Python 3.4 in the same code
base. Same rationale for asyncio._overlapped. Python 3.3 reached its
end of life, and asyncio is no more maintained as a third party
module on PyPI.
2017-11-28 15:19:56 +01:00
Victor Stinner 3f438a9fa0
asyncio: Remove asyncio/compat.py (#4606)
The asyncio/compat.py file was written to support Python < 3.5 and
Python < 3.5.2. But Python 3.5 doesn't accept bugfixes anymore, only
security fixes. There is no more need to backport bugfixes to Python
3.5, and so no need to have a single code base for Python 3.5, 3.6
and 3.7.

Say hello (again) to "async" and "await", who became real keywords in
Python 3.7 ;-)
2017-11-28 14:43:52 +01:00
Victor Stinner a10dc3efcb
asyncio: use directly socket.socketpair() (#4597)
Since Python 3.5, socket.socketpair() is also available on Windows,
and so can be used directly, rather than using
asyncio.windows_utils.socketpair().
2017-11-28 11:15:26 +01:00
Victor Stinner c16bacec3c
asyncio: Remove unused Future._tb_logger attribute (#4596)
It was only used on Python 3.3, now only Future._log_traceback is
used.
2017-11-28 00:35:33 +01:00
Victor Stinner 28e61650b2
bpo-31245: asyncio: Fix typo, isistance => isinstance (#4594) 2017-11-28 00:34:08 +01:00
Yury Selivanov 423fd362f8
bpo-32066: Support pathlib.Path in create_unix_connection; sock arg should be optional (#4447) 2017-11-20 17:26:28 -05:00
Victor Stinner 44862df2ee
bpo-32047: -X dev enables asyncio debug mode (#4418)
The new -X dev command line option now also enables asyncio debug
mode.
2017-11-20 07:14:07 -08:00
Andrew Svetlov 51d546ae4d
bpo-32069: Drop legacy SSL transport (#4451)
* Drop legacy SSL transport

* Drop unused import

* Fix Windows tests

* Drop never executed on Python 3.4+ code
2017-11-18 18:54:05 +02:00
Yury Selivanov 43605e6bfa
bpo-32034: Make IncompleteReadError & LimitOverrunError pickleable #4409 2017-11-15 17:14:28 -05:00
Andrey Egorov e1d62e0b7c bpo-32015: Asyncio looping during simultaneously socket read/write an… (#4386)
* bpo-32015: Asyncio cycling during simultaneously socket read/write and reconnection

* Tests fix

* Tests fix

* News add

* Add new unit tests
2017-11-14 11:18:59 +02:00
Yury Selivanov ce12629c84
bpo-28369: Enhance transport socket check in add_reader/writer (#4365) 2017-11-13 13:38:22 -05:00
Suren Nihalani c62f0cb3b1 bpo-31620: have asyncio/queues not leak memory when you've exceptions during waiting (#3813) 2017-11-07 20:35:23 +03:00
Barry Warsaw c060c7e3d1
Fix a typo (#4323) 2017-11-07 09:05:15 -08:00
Antoine Pitrou 921e9432a1
bpo-31970: Reduce performance overhead of asyncio debug mode. (#4314)
* bpo-31970: Reduce performance overhead of asyncio debug mode.
2017-11-07 17:23:29 +01:00
Antoine Pitrou 22b1128559
bpo-31960: Fix asyncio.Future documentation for thread (un)safety. (#4319) 2017-11-07 17:03:28 +01:00
Marat Sharafutdinov 69cfed1cd7 Add asyncio.Handle.cancelled() method (#2388) 2017-11-07 12:06:05 +03:00
Quentin Dawans fe4ea9cf1e bpo-31245: Asyncio unix socket datagram (#3164) 2017-10-30 09:43:02 -04:00
Antoine Pitrou 525f40d231 bpo-31819: Add AbstractEventLoop.sock_recv_into() (#4051)
* bpo-31819: Add AbstractEventLoop.sock_recv_into()

* Add NEWS

* Add doc
2017-10-19 15:46:40 -04:00
jlacoline ea2ef5d0ca bpo-31632: fix set_protocol() in _SSLProtocolTransport (#3817) (#3817) 2017-10-19 13:49:57 -04:00
Yury Selivanov faa135acbf bpo-31709: Drop support for asynchronous __aiter__. (#3903) 2017-10-06 02:08:57 -04:00
Victor K 4d07189788 bpo-31556: asyncio.wait_for can cancel futures faster with timeout <= 0 (#3703) 2017-10-05 12:04:39 -04:00
Christian Heimes a170fa162d bpo-31346: Use PROTOCOL_TLS_CLIENT/SERVER (#3058)
Replaces PROTOCOL_TLSv* and PROTOCOL_SSLv23 with PROTOCOL_TLS_CLIENT and
PROTOCOL_TLS_SERVER.

Signed-off-by: Christian Heimes <christian@python.org>
2017-09-15 20:27:30 +02:00
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