Commit graph

590 commits

Author SHA1 Message Date
Yury Selivanov 9edad3c701
bpo-32272: Remove asyncio.async() function. (#4784) 2017-12-11 10:03:48 -05:00
Yury Selivanov 19d0d54809
bpo-32262: Fix f-string (#4787) 2017-12-10 19:52:53 -05:00
Yury Selivanov 6370f345e1
bpo-32262: Fix codestyle; use f-strings formatting where necessary. (#4775) 2017-12-10 18:36:12 -05:00
Andrew Svetlov 28d8d14013
bpo-32253: Deprecate with statement and bare await for asyncio locks (GH-4764)
* Add test for 'with (yield from lock)'
* Deprecate with statement for asyncio locks
* Document the deprecation
2017-12-09 20:00:05 +02:00
Andrew Svetlov 5f841b5538
bpo-32193: Convert asyncio to async/await usage (#4753)
* Convert asyncio/tasks.py to async/await

* Convert asyncio/queues.py to async/await

* Convert asyncio/test_utils.py to async/await

* Convert asyncio/base_subprocess.py to async/await

* Convert asyncio/subprocess.py to async/await

* Convert asyncio/streams.py to async/await

* Fix comments

* Convert asyncio/locks.py to async/await

* Convert asyncio.sleep to async def

* Add a comment

* Add missing news

* Convert stubs from AbstrctEventLoop to async functions

* Convert subprocess_shell/subprocess_exec

* Convert connect_read_pipe/connect_write_pip to async/await syntax

* Convert create_datagram_endpoint

* Convert create_unix_server/create_unix_connection

* Get rid of old style coroutines in unix_events.py

* Convert selector_events.py to async/await

* Convert wait_closed and create_connection

* Drop redundant line

* Convert base_events.py

* Code cleanup

* Drop redundant comments

* Fix indentation

* Add explicit tests for compatibility between old and new coroutines

* Convert windows event loop to use async/await

* Fix double awaiting of async function

* Convert asyncio/locks.py

* Improve docstring

* Convert tests to async/await

* Convert more tests

* Convert more tests

* Convert more tests

* Convert tests

* Improve test
2017-12-09 00:23:48 +02:00
John Chen 8f5c28b193 Fix asyncio.streams.FlowControlMixin docstring typo. (#4578) 2017-12-01 14:33:40 +02:00
Victor Stinner 5e3806f8cf
bpo-32101: Add PYTHONDEVMODE environment variable (#4624)
* bpo-32101: Add sys.flags.dev_mode flag
  Rename also the "Developer mode" to the "Development mode".
* bpo-32101: Add PYTHONDEVMODE environment variable
  Mention it in the development chapiter.
2017-11-30 11:40:24 +01:00
Andrew Svetlov cc83920ad2
bpo-32166: Drop Python 3.4 code from asyncio (#4612)
* Drop Python 3.4 code from asyncio

* Fix notes

* Add missing imports

* Restore comment

* Resort imports

* Drop Python 3.4-3.5 specific code

* Drop redunant check

* Fix tests

* Restore _COROUTINE_TYPES order

* Remove useless code
2017-11-29 18:23:43 +02:00
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