summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_coroutines.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-35202: Remove unused imports in tests. (GH-10561)Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి)2018-11-161-1/+0
|
* bpo-33562: Check the global asyncio event loop policy isn't set after any ↵Brett Cannon2018-06-021-1/+1
| | | | tests (GH-7328)
* bpo-33363: raise SyntaxError for async for/with outside async functions (#6616)Zsolt Dollenstein2018-04-271-1/+16
|
* bpo-29922: Add more tests for error messages in 'async with'. (GH-6370)Serhiy Storchaka2018-04-041-1/+41
| | | | Different paths are executed for normal exit and for leaving the 'async with' block with 'break', 'continue' or 'return'.
* bpo-29922: Improve error messages in 'async with' (GH-6352)Serhiy Storchaka2018-04-021-4/+9
| | | when __aenter__() or __aexit__() return non-awaitable object.
* bpo-33041: Rework compiling an "async for" loop. (#6142)Serhiy Storchaka2018-03-231-0/+30
| | | | | | | | * Added new opcode END_ASYNC_FOR. * Setting global StopAsyncIteration no longer breaks "async for" loops. * Jumping into an "async for" loop is now disabled. * Jumping out of an "async for" loop no longer corrupts the stack. * Simplify the compiler.
* bpo-33041: Fixed bytecode generation for "async for" with a complex target. ↵Serhiy Storchaka2018-03-101-0/+65
| | | | | | (#6052) A StopAsyncIteration raised on assigning or unpacking will be now propagated instead of stopping the iteration.
* bpo-32733: Make test_coroutines robust against -Werror (GH-5487)Nathaniel J. Smith2018-02-021-7/+2
|
* bpo-32703: Fix coroutine resource warning in case where there's an error ↵Yury Selivanov2018-01-291-33/+63
| | | | | (GH-5410) The commit removes one unnecessary "if" clause in genobject.c. That "if" clause was masking un-awaited coroutines warnings just to make writing unittests more convenient.
* bpo-32591: silence deprecation warnings in test_coroutine (GH-5412)Nathaniel J. Smith2018-01-291-10/+20
|
* bpo-32591: fix abort in _PyErr_WarnUnawaitedCoroutine during shutdown (#5337)Nathaniel J. Smith2018-01-261-0/+22
| | | | | | | | | | | | | | | | | | When an unawaited coroutine is collected very late in shutdown -- like, during the final GC at the end of PyImport_Cleanup -- then it was triggering an interpreter abort, because we'd try to look up the "warnings" module and not only was it missing (we were prepared for that), but the entire module system was missing (which we were not prepared for). I've tried to fix this at the source, by making the utility function get_warnings_attr robust against this in general. Note that it already has the convention that it can return NULL without setting an error, which is how it signals that the attribute it was asked to fetch is missing, and that all callers already check for NULL returns. There's a similar check for being late in shutdown at the top of warn_explicit, which might be unnecessary after this fix, but I'm not sure so I'm going to leave it.
* bpo-32591: Add native coroutine origin tracking (#5250)Nathaniel J. Smith2018-01-211-2/+129
| | | | | | * Add coro.cr_origin and sys.set_coroutine_origin_tracking_depth * Use coroutine origin information in the unawaited coroutine warning * Stop using set_coroutine_wrapper in asyncio debug mode * In BaseEventLoop.set_debug, enable debugging in the correct thread
* bpo-31708: Allow async generator expressions in synchronous functions (#3905)Yury Selivanov2017-10-061-0/+8
|
* bpo-31709: Drop support for asynchronous __aiter__. (#3903)Yury Selivanov2017-10-061-91/+19
|
* bpo-30406: Make async and await proper keywords (#1669)Jelle Zijlstra2017-10-061-18/+6
| | | Per PEP 492, 'async' and 'await' should become proper keywords in 3.7.
* bpo-29845: Mark tests that use _testcapi as CPython-only (#711)Serhiy Storchaka2017-03-191-0/+1
|
* Fix wrapping into StopIteration of return values in generators and ↵Yury Selivanov2017-03-121-0/+15
| | | | coroutines (#644)
* bpo-28893: Set __cause__ for errors in async iteration protocol (#407)Yury Selivanov2017-03-031-0/+38
|
* Issue #27243: Change PendingDeprecationWarning -> DeprecationWarning.Yury Selivanov2016-11-081-9/+9
| | | | | | As it was agreed in the issue, __aiter__ returning an awaitable should result in PendingDeprecationWarning in 3.5 and in DeprecationWarning in 3.6.
* Issue #23996: Added _PyGen_SetStopIterationValue for safe raisingSerhiy Storchaka2016-11-061-0/+61
|\ | | | | | | | | StopIteration with value. More safely handle non-normalized exceptions in -_PyGen_FetchStopIterationValue.
| * Issue #23996: Added _PyGen_SetStopIterationValue for safe raisingSerhiy Storchaka2016-11-061-0/+61
| | | | | | | | | | StopIteration with value. More safely handle non-normalized exceptions in -_PyGen_FetchStopIterationValue.
* | Issue #26182: Raise DeprecationWarning for improper use of async/await keywordsYury Selivanov2016-09-151-42/+95
| |
* | Issue #28008: Implement PEP 530 -- asynchronous comprehensions.Yury Selivanov2016-09-091-32/+292
| |
* | Issue #28003: Implement PEP 525 -- Asynchronous Generators.Yury Selivanov2016-09-091-6/+0
| |
* | #27364: fix "incorrect" uses of escape character in the stdlib.R David Murray2016-09-081-4/+4
|/ | | | | | | And most of the tools. Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and Martin Panter.
* capture stderr to silence output during test_coroutines (closes #27968)Benjamin Peterson2016-09-071-1/+2
|
* do not allow _PyGen_Finalize to fail (closes #27811)Benjamin Peterson2016-09-051-0/+8
| | | | Patch from Armin Rigo.
* Fix typos and English grammar in documentation and code commentMartin Panter2016-06-121-1/+1
|
* Issue #27243: Fix __aiter__ protocolYury Selivanov2016-06-091-20/+78
|
* coroutines: Error when awaiting on coroutine that's being awaitedYury Selivanov2016-03-021-0/+18
| | | | Issue #25888
* Issue #25887: Raise a RuntimeError when a coroutine is awaited more than once.Yury Selivanov2016-02-131-0/+141
|
* Issue #22995: Default implementation of __reduce__ and __reduce_ex__ nowSerhiy Storchaka2015-11-121-0/+30
| | | | | rejects builtin types with not defined __new__. Added tests for non-pickleable types.
* Close #25367: Fix test_coroutines()Victor Stinner2015-10-111-1/+1
| | | | | Fix usage of support.import_module('asyncio'): store the result in an 'asyncio' variable.
* Close #25367: Fix test_coroutines with no thread supportVictor Stinner2015-10-111-1/+3
| | | | | Skip test_asyncio_1() when the asyncio module cannot be imported because CPython is compiled with no thread support.
* Issue #24619: Simplify async/await tokenization.Yury Selivanov2015-07-231-0/+1
| | | | | | | | | | This commit simplifies async/await tokenization in tokenizer.c, tokenize.py & lib2to3/tokenize.py. Previous solution was to keep a stack of async-def & def blocks, whereas the new approach is just to remember position of the outermost async-def block. This change won't bring any parsing performance improvements, but it makes the code much easier to read and validate.
* Issue #24687: Plug refleak on SyntaxError in function parameters annotations.Yury Selivanov2015-07-231-0/+4
|
* Issue #24619: More tests; fix nits in compiler.cYury Selivanov2015-07-221-4/+5
|
* Issue #24619: New approach for tokenizing async/await.Yury Selivanov2015-07-221-8/+218
| | | | | | | | | | | | | | | | | | | | | This commit fixes how one-line async-defs and defs are tracked by tokenizer. It allows to correctly parse invalid code such as: >>> async def f(): ... def g(): pass ... async = 10 and valid code such as: >>> async def f(): ... async def g(): pass ... await z As a consequence, is is now possible to have one-line 'async def foo(): await ..' functions: >>> async def foo(): return await bar()
* Issue #24450: Add gi_yieldfrom to generators; cr_await to coroutines.Yury Selivanov2015-07-031-0/+30
| | | | Patch by Benno Leslie and Yury Selivanov.
* Issue #24400: Add one more unittest for CoroutineType.__await__Yury Selivanov2015-07-011-0/+34
|
* test_coroutines: remove whitespaceYury Selivanov2015-06-301-1/+1
|
* Issue #24528: Improve error message for awaits in comprehensionsYury Selivanov2015-06-301-0/+10
|
* Issue #24400: Introduce a distinct type for 'async def' coroutines.Yury Selivanov2015-06-221-14/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 24374: Plug refleak in set_coroutine_wrapperYury Selivanov2015-06-041-2/+2
|
* Issue 24342: Let wrapper set by sys.set_coroutine_wrapper fail gracefullyYury Selivanov2015-06-021-0/+20
|
* Issue 24226: Fix parsing of many sequential one-line 'def' statements.Yury Selivanov2015-05-181-0/+23
|
* Issue 24017: More tests for 'async for' and 'async with'.Yury Selivanov2015-05-131-0/+35
|
* Clean up test_coroutines a bit.Zachary Ware2015-05-131-12/+3
| | | | No more test_main(), s/assertEquals/assertEqual/, and remove unused import.
* Issue 24017: fix for "async with" refcountingNick Coghlan2015-05-131-1/+117
| | | | | | * adds missing INCREF in WITH_CLEANUP_START * adds missing DECREF in WITH_CLEANUP_FINISH * adds several new tests Yury created while investigating this
* Issue #24017: Unset asyncio event loop after test.Yury Selivanov2015-05-121-1/+3
|