summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_coroutines.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-33346: Allow async comprehensions inside implicit async comprehensions ↵Serhiy Storchaka2021-07-131-0/+72
| | | | | (GH-6766) Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
* bpo-12022: Change error type for bad objects in "with" and "async with" ↵Serhiy Storchaka2021-06-291-3/+3
| | | | | | | | | (GH-26809) A TypeError is now raised instead of an AttributeError in "with" and "async with" statements for objects which do not support the context manager or asynchronous context manager protocols correspondingly.
* bpo-44469: Fix tests for "async with" with bad object (GH-26817)Serhiy Storchaka2021-06-211-6/+12
| | | | Test for execution of the body was null. It would pass even if the code which should be skipped was executed.
* bpo-38605: Revert making 'from __future__ import annotations' the default ↵Pablo Galindo2021-04-211-0/+8
| | | | | | (GH-25490) This reverts commits 044a1048ca93d466965afc027b91a5a9eb9ce23c and 1be456ae9d53bb1cba2b24fc86175c282d1c2169, adapting the code to changes that happened after it.
* bpo-38605: Make 'from __future__ import annotations' the default (GH-20434)Batuhan Taskaya2020-10-061-8/+0
| | | | | The hard part was making all the tests pass; there are some subtle issues here, because apparently the future import wasn't tested very thoroughly in previous Python versions. For example, `inspect.signature()` returned type objects normally (except for forward references), but strings with the future import. We changed it to try and return type objects by calling `typing.get_type_hints()`, but fall back on returning strings if that function fails (which it may do if there are future references in the annotations that require passing in a specific namespace to resolve).
* bpo-40275: Use new test.support helper submodules in tests (GH-21449)Hai Shi2020-08-031-5/+8
|
* bpo-39048: Look up __aenter__ before __aexit__ in async with (GH-17609)Géry Ogam2020-01-141-9/+11
| | | | | | * Reorder the __aenter__ and __aexit__ checks for async with * Add assertions for async with body being skipped * Swap __aexit__ and __aenter__ loading in the documentation
* bpo-37069: tests use catch_unraisable_exception() (GH-13762)Victor Stinner2019-06-031-3/+9
| | | | | | | | | | | | | Modify test_coroutines, test_cprofile, test_generators, test_raise, test_ssl and test_yield_from to use support.catch_unraisable_exception() rather than support.captured_stderr(). test_thread: remove test_save_exception_state_on_error() which is now updated. test_unraisable_exception() checks that sys.unraisablehook() is called to handle _thread.start_new_thread() exception. test_cprofile now rely on unittest for test discovery: replace support.run_unittest() with unittest.main().
* bpo-37100: Fix test_coroutines with -Werror (GH-13756)Victor Stinner2019-06-021-4/+4
| | | | test_coroutines: test_unawaited_warning_when_module_broken() now uses support.check_warnings() to catch expected RuntimeWarning.
* bpo-36933: Remove sys.set_coroutine_wrapper (marked for removal in 3.8) ↵Matthias Bussonnier2019-05-281-93/+0
| | | | | | | | | | (GH-13577) It has been documented as deprecated and to be removed in 3.8; From a comment on another thread – which I can't find ; leave get_coro_wrapper() for now, but always return `None`. https://bugs.python.org/issue36933
* bpo-36829: Add test.support.catch_unraisable_exception() (GH-13490)Victor Stinner2019-05-221-5/+12
| | | | | | * Copy test_exceptions.test_unraisable() to test_sys.UnraisableHookTest(). * Use catch_unraisable_exception() in test_coroutines, test_exceptions, test_generators.
* 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.