summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio
Commit message (Collapse)AuthorAgeFilesLines
* Merge 3.4 (Issue #24450)Yury Selivanov2015-07-031-0/+8
|\
| * Issue #24450: Proxy gi_yieldfrom & cr_await in asyncio.CoroWrapperYury Selivanov2015-07-031-0/+8
| |
* | Fix asyncio unittests in debug modeYury Selivanov2015-06-241-0/+2
|\ \ | |/
| * Fix asyncio unittests in debug modeYury Selivanov2015-06-241-0/+2
| |
* | Issue #24400: Fix CoroWrapper for 'async def' coroutinesYury Selivanov2015-06-241-10/+40
|\ \ | |/
| * Issue #24400: Fix CoroWrapper for 'async def' coroutinesYury Selivanov2015-06-241-10/+40
| |
| * asyncio: Merge changes from issue #24400.Yury Selivanov2015-06-241-31/+17
| |
* | Issue #24400: Introduce a distinct type for 'async def' coroutines.Yury Selivanov2015-06-221-31/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary of changes: 1. Coroutines now have a distinct, separate from generators type at the C level: PyGen_Type, and a new typedef PyCoroObject. PyCoroObject shares the initial segment of struct layout with PyGenObject, making it possible to reuse existing generators machinery. The new type is exposed as 'types.CoroutineType'. As a consequence of having a new type, CO_GENERATOR flag is no longer applied to coroutines. 2. Having a separate type for coroutines made it possible to add an __await__ method to the type. Although it is not used by the interpreter (see details on that below), it makes coroutines naturally (without using __instancecheck__) conform to collections.abc.Coroutine and collections.abc.Awaitable ABCs. [The __instancecheck__ is still used for generator-based coroutines, as we don't want to add __await__ for generators.] 3. Add new opcode: GET_YIELD_FROM_ITER. The opcode is needed to allow passing native coroutines to the YIELD_FROM opcode. Before this change, 'yield from o' expression was compiled to: (o) GET_ITER LOAD_CONST YIELD_FROM Now, we use GET_YIELD_FROM_ITER instead of GET_ITER. The reason for adding a new opcode is that GET_ITER is used in some contexts (such as 'for .. in' loops) where passing a coroutine object is invalid. 4. Add two new introspection functions to the inspec module: getcoroutinestate(c) and getcoroutinelocals(c). 5. inspect.iscoroutine(o) is updated to test if 'o' is a native coroutine object. Before this commit it used abc.Coroutine, and it was requested to update inspect.isgenerator(o) to use abc.Generator; it was decided, however, that inspect functions should really be tailored for checking for native types. 6. sys.set_coroutine_wrapper(w) API is updated to work with only native coroutines. Since types.coroutine decorator supports any type of callables now, it would be confusing that it does not work for all types of coroutines. 7. Exceptions logic in generators C implementation was updated to raise clearer messages for coroutines: Before: TypeError("generator raised StopIteration") After: TypeError("coroutine raised StopIteration")
* | Issue 24017: Fix asyncio.CoroWrapper to support 'async def' coroutinesYury Selivanov2015-06-011-1/+1
|\ \ | |/
| * Issue 24017: Fix asyncio.CoroWrapper to support 'async def' coroutinesYury Selivanov2015-06-011-1/+1
| |
* | Issue 24004: Support Awaitables (pep 492) in @asyncio.coroutine decoratorYury Selivanov2015-05-311-2/+13
|\ \ | |/ | | | | (Merge 3.4)
| * Issue 24004: Support Awaitables (pep 492) in @asyncio.coroutine decoratorYury Selivanov2015-05-311-2/+13
| |
* | asyncio: Drop some useless code from tasks.py.Yury Selivanov2015-05-281-7/+2
|\ \ | |/ | | | | See also issue 24017.
| * asyncio: Drop some useless code from tasks.py.Yury Selivanov2015-05-281-7/+2
| | | | | | | | See also issue 24017.
* | asyncio: Use 'collections.abc.Coroutine' in asyncio.iscoroutine.Yury Selivanov2015-05-131-0/+8
|\ \ | |/
| * asyncio: Use 'collections.abc.Coroutine' in asyncio.iscoroutine (in 3.5)Yury Selivanov2015-05-131-0/+8
| |
| * Sync asyncio code from default branch.Yury Selivanov2015-05-132-55/+67
| |
* | Issue 24179: Support 'async for' for asyncio.StreamReader.Yury Selivanov2015-05-131-0/+14
| |
* | Issue 24178: support 'async with' for asyncio locks.Yury Selivanov2015-05-131-55/+53
| |
* | asyncio: Make sure sys.set_coroutine_wrapper is called *only* when loop is ↵Yury Selivanov2015-05-121-35/+45
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | 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.
| * asyncio: Make sure sys.set_coroutine_wrapper is called *only* when loop is ↵Yury Selivanov2015-05-121-35/+45
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | asyncio: Merge 3.4 -- Support PEP 492. Issue #24017.Yury Selivanov2015-05-124-24/+112
|\ \ | |/
| * asyncio: Support PEP 492. Issue #24017.Yury Selivanov2015-05-124-24/+112
| |
* | Merge 3.4 (asyncio changes)Yury Selivanov2015-05-113-8/+23
|\ \ | |/
| * asyncio: async() function is deprecated in favour of ensure_future().Yury Selivanov2015-05-113-8/+23
| |
| * Sync asyncio changes from the main repo.Yury Selivanov2015-05-112-12/+42
| |
* | asyncio: Drop JoinableQueue from 3.5Yury Selivanov2015-05-111-6/+1
| |
* | asyncio: Sync with github repoYury Selivanov2015-05-113-13/+48
| |
* | Asyncio issue 222 / PR 231 (Victor Stinner) -- fix @coroutine functions ↵Guido van Rossum2015-05-033-11/+23
|\ \ | |/ | | | | without __name__. (Merged from 3.4 branch.)
| * Asyncio issue 222 / PR 231 (Victor Stinner) -- fix @coroutine functions ↵Guido van Rossum2015-05-033-11/+23
| | | | | | | | without __name__.
* | Fix asyncio issue 235 (merge from 3.4).Guido van Rossum2015-04-201-6/+13
|\ \ | |/
| * Fix asyncio issue 235: Queue subclass bug caused by JoinableQueue merge.Guido van Rossum2015-04-201-6/+13
| |
* | #23464: remove JoinableQueue that was deprecated in 3.4.4.R David Murray2015-04-121-6/+1
|/ | | | Patch by A. Jesse Jiryu Davis.
* Issue #23879, asyncio: SelectorEventLoop.sock_connect() must not call connect()Victor Stinner2015-04-071-8/+6
| | | | | | | | 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.
* asyncio: Fix _SelectorTransport.__repr__() if the event loop is closedVictor Stinner2015-03-271-1/+1
|
* Issue #23456: Add missing @coroutine decorators in asyncioVictor Stinner2015-03-183-0/+5
|
* asyncio: Fix repr(BaseSubprocessTransport) if it didn't start yetVictor Stinner2015-03-101-2/+5
| | | | | Replace "running" with "not started" and don't show the pid if the subprocess didn't start yet.
* Issue #23537: Remove 2 unused private methods of asyncio.BaseSubprocessTransportVictor Stinner2015-02-271-6/+0
| | | | Methods only raise NotImplementedError and are never used.
* asyncio, Tulip issue 220: Merge JoinableQueue with Queue.Victor Stinner2015-02-171-59/+43
| | | | | | | | | | | | | | 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>.
* asyncio: BaseSubprocessTransport: repr() mentions when the child process isVictor Stinner2015-02-171-0/+2
| | | | running
* asyncio: BaseSubprocessTransport.close() doesn't try to kill the process if itVictor Stinner2015-02-101-1/+6
| | | | already finished
* asyncio: BaseEventLoop: rename _owner to _thread_idVictor Stinner2015-02-051-6/+6
|
* asyncio: Only call _check_resolved_address() in debug modeVictor Stinner2015-02-043-18/+36
| | | | | | | | | | | | | | | | * _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.
* asyncio: BaseSelectorEventLoop uses directly the private _debug attributeVictor Stinner2015-02-041-5/+5
| | | | | Just try to be consistent: _debug was already used in some places, and always used in BaseProactorEventLoop.
* asyncio, Tulip issue 221: Fix doc of QueueEmpty and QueueFullVictor Stinner2015-02-031-2/+6
|
* Issue #23353, asyncio: Workaround CPython bug #23353Victor Stinner2015-02-023-4/+23
| | | | | Don't use yield/yield-from in an except block of a generator. Store the exception and handle it outside the except block.
* Issue #23347, asyncio: send_signal(), terminate(), kill() don't check if theVictor Stinner2015-01-301-4/+3
| | | | | | | 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.
* Issue #23347, asyncio: Make BaseSubprocessTransport.wait() privateVictor Stinner2015-01-294-4/+4
|
* asyncio: sync with TulipVictor Stinner2015-01-294-87/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Issue #23243, asyncio: Emit a ResourceWarning when an event loop or a transportVictor Stinner2015-01-298-5/+96
| | | | is not explicitly closed. Close also explicitly transports in test_sslproto.