Commit Graph

26 Commits

Author SHA1 Message Date
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
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
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
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
Yury Selivanov c92bf83a82 Issue #22970: asyncio: Fix inconsistency cancelling Condition.wait.
Patch by David Coles.
2016-06-11 12:00:07 -04:00
Martin Panter 3ee6270262 Fix typos in code comment and documentation 2016-06-04 04:57:19 +00:00
Yury Selivanov 7661db6228 Issue #27041: asyncio: Add loop.create_future method 2016-05-16 15:38:39 -04:00
Guido van Rossum d455a50773 Also rewrote the guts of asyncio.Semaphore (patch by manipopopo). 2015-09-29 11:54:45 -07: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
Yury Selivanov d08c363c26 Sync asyncio code from default branch. 2015-05-13 15:15:56 -04:00
Victor Stinner d6dc7bdaf9 Issue #23456: Add missing @coroutine decorators in asyncio 2015-03-18 11:37:42 +01:00
Serhiy Storchaka 148679982f Issue #22369: Change "context manager protocol" to "context management protocol". 2014-09-10 23:43:41 +03:00
Andrew Svetlov f21fcd09c5 Accept optional lock object in Condition ctor (tulip issue #198) 2014-07-26 17:54:34 +03:00
Victor Stinner f951d28ac8 asyncio: sync with Tulip, add a new asyncio.coroutines module 2014-06-29 00:46:45 +02:00
Guido van Rossum ab3c88983b asyncio: Locks refactor: use a separate context manager; remove Semaphore._locked. 2014-01-25 16:51:57 -08:00
Guido van Rossum 2407f3bb1b asyncio: Don't special-case GeneratorExit in Condition.wait(). 2014-01-10 13:25:38 -08:00
Guido van Rossum 994bf4332f Shorten lines. 2013-12-19 12:47:38 -08:00
Victor Stinner 10a8e6ab7b asyncio: replace our with asynchronous in docstring 2013-12-02 14:31:43 +01:00
Victor Stinner c37dd614b6 asyncio: document locks 2013-12-02 14:31:16 +01:00
Guido van Rossum a58d1c32f8 asyncio: Add BoundedSemaphore to export list in locks.__all__. 2013-11-24 22:32:09 -08:00
Guido van Rossum 085869bfee asyncio: Change bounded semaphore into a subclass, like threading.[Bounded]Semaphore. 2013-11-23 15:09:16 -08:00
Guido van Rossum 9c55a58a1d asyncio: Make Semaphore(0) work properly. 2013-11-21 11:07:45 -08:00
Guido van Rossum ccea08462b asyncio: Locks improvements by Arnaud Faure: better repr(), change Conditio\
n structure.
2013-11-04 13:18:19 -08:00
Guido van Rossum 27b7c7ebf1 Initial checkin of asyncio package (== Tulip, == PEP 3156). 2013-10-17 13:40:50 -07:00