Skip to content

Commit b80f03f

Browse files
committed
[GR-69508] Bytecode DSL: async generators.
PullRequest: graalpython/4107
2 parents 0e34d95 + 81417ee commit b80f03f

34 files changed

+838
-283
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_interop.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,8 +959,6 @@ def l(*elements):
959959
assert [e for e in reversed(al)] == [3,2,1]
960960
assert [e for e in al] == [1,2,3]
961961

962-
# AssertionError: "descriptor requires a 'dict' object but received a 'ForeignDict'" does not match "object.__new__(ForeignDict) is not safe, use ForeignDict.__new__()"
963-
@unittest.skipIf(os.environ.get('BYTECODE_DSL_INTERPRETER'), "TODO: bug in comment above")
964962
def test_java_map(self):
965963
from java.util import HashMap
966964
h = HashMap()

graalpython/com.oracle.graal.python.test/src/tests/test_traceback.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ def test():
104104
)
105105

106106

107-
@unittest.skipIf(os.environ.get('BYTECODE_DSL_INTERPRETER'), "TODO: correct generator tracebacks")
108107
def test_basic_traceback_generator():
109108
def foo():
110109
yield 1
@@ -141,7 +140,6 @@ def reraise():
141140
)
142141

143142

144-
@unittest.skipIf(os.environ.get('BYTECODE_DSL_INTERPRETER'), "TODO: bug in comment above")
145143
def test_reraise_direct_generator():
146144
def reraise():
147145
try:
@@ -401,7 +399,6 @@ def reraise_from_finally():
401399
)
402400

403401

404-
@unittest.skipIf(os.environ.get('BYTECODE_DSL_INTERPRETER'), "TODO: bug in comment above")
405402
def test_finally_generator():
406403
def test():
407404
try:
@@ -426,7 +423,6 @@ def test():
426423
)
427424

428425

429-
@unittest.skipIf(os.environ.get('BYTECODE_DSL_INTERPRETER'), "TODO: bug in comment above")
430426
def test_reraise_from_finally_generator():
431427
def reraise_from_finally():
432428
try:
@@ -491,7 +487,6 @@ def test():
491487
)
492488

493489

494-
@unittest.skipIf(os.environ.get('BYTECODE_DSL_INTERPRETER'), "TODO: correct generator tracebacks")
495490
def test_generator_throw_existing():
496491
try:
497492
raise OverflowError
@@ -514,7 +509,6 @@ def test():
514509
)
515510

516511

517-
@unittest.skipIf(os.environ.get('BYTECODE_DSL_INTERPRETER'), "TODO: correct generator tracebacks")
518512
def test_generator_throw_with_traceback():
519513
try:
520514
raise NameError

graalpython/com.oracle.graal.python.test/src/tests/test_yield_from.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,6 @@ def g():
976976
# for stack in spam(eggs(gen())):
977977
# self.assertTrue('spam' in stack and 'eggs' in stack)
978978

979-
@unittest.skipIf(os.environ.get('BYTECODE_DSL_INTERPRETER'), "TODO: bug in comment above")
980979
def test_custom_iterator_return(self):
981980
# See issue #15568
982981
class MyIter:
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,50 @@
11
test.test_asyncgen.AsyncGenAsyncioTest.test_aiter_bad_args @ linux-x86_64
2+
test.test_asyncgen.AsyncGenAsyncioTest.test_aiter_idempotent @ linux-x86_64
23
test.test_asyncgen.AsyncGenAsyncioTest.test_anext_bad_args @ linux-x86_64
34
test.test_asyncgen.AsyncGenAsyncioTest.test_anext_return_generator @ linux-x86_64
45
test.test_asyncgen.AsyncGenAsyncioTest.test_anext_return_iterator @ linux-x86_64
6+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_aclose_after_exhaustion @ linux-x86_64
7+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_aclose_compatible_with_get_stack @ linux-x86_64
8+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_aclose_twice_with_different_coros @ linux-x86_64
9+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_aiter @ linux-x86_64
10+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_aiter_class @ linux-x86_64
11+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_01 @ linux-x86_64
12+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_02 @ linux-x86_64
13+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_03 @ linux-x86_64
14+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_aclose_10 @ linux-x86_64
15+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_aclose_11 @ linux-x86_64
16+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_anext_04 @ linux-x86_64
17+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_anext_05 @ linux-x86_64
18+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_anext_06 @ linux-x86_64
19+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_anext_stopiteration @ linux-x86_64
20+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_anext_tuple @ linux-x86_64
21+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_asend_01 @ linux-x86_64
22+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_asend_02 @ linux-x86_64
23+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_asend_03 @ linux-x86_64
24+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_athrow_01 @ linux-x86_64
25+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_athrow_02 @ linux-x86_64
26+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_athrow_03 @ linux-x86_64
27+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_athrow_stopiteration @ linux-x86_64
28+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_athrow_tuple @ linux-x86_64
29+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_01 @ linux-x86_64
30+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_02 @ linux-x86_64
31+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_shutdown_exception_01 @ linux-x86_64
32+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_await_same_aclose_coro_twice @ linux-x86_64
33+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_await_same_anext_coro_twice @ linux-x86_64
34+
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_expression_01 @ linux-x86_64
35+
test.test_asyncgen.AsyncGenAsyncioTest.test_asyncgen_nonstarted_hooks_are_cancellable @ linux-x86_64
536
test.test_asyncgen.AsyncGenSyntaxTest.test_async_gen_syntax_01 @ linux-x86_64
637
test.test_asyncgen.AsyncGenSyntaxTest.test_async_gen_syntax_02 @ linux-x86_64
38+
test.test_asyncgen.AsyncGenSyntaxTest.test_async_gen_syntax_03 @ linux-x86_64
39+
test.test_asyncgen.AsyncGenSyntaxTest.test_async_gen_syntax_04 @ linux-x86_64
40+
test.test_asyncgen.AsyncGenSyntaxTest.test_async_gen_syntax_05 @ linux-x86_64
41+
test.test_asyncgen.AsyncGenTest.test_async_gen_exception_03 @ linux-x86_64
42+
test.test_asyncgen.AsyncGenTest.test_async_gen_exception_04 @ linux-x86_64
43+
test.test_asyncgen.AsyncGenTest.test_async_gen_exception_05 @ linux-x86_64
44+
test.test_asyncgen.AsyncGenTest.test_async_gen_exception_07 @ linux-x86_64
45+
test.test_asyncgen.AsyncGenTest.test_async_gen_exception_08 @ linux-x86_64
46+
test.test_asyncgen.AsyncGenTest.test_async_gen_exception_09 @ linux-x86_64
47+
test.test_asyncgen.AsyncGenTest.test_async_gen_exception_11 @ linux-x86_64
48+
test.test_asyncgen.AsyncGenTest.test_async_gen_exception_12 @ linux-x86_64
49+
test.test_asyncgen.AsyncGenTest.test_async_gen_iteration_01 @ linux-x86_64
50+
test.test_asyncgen.AsyncGenTest.test_async_gen_iteration_02 @ linux-x86_64

graalpython/com.oracle.graal.python.test/src/tests/unittest_tags_bytecode_dsl/test_asyncio.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ test.test_asyncio.test_pep492.CoroutineTests.test_task_print_stack @ linux-x86_6
354354
test.test_asyncio.test_pep492.CoroutineTests.test_types_coroutine @ linux-x86_64
355355
test.test_asyncio.test_pep492.LockTests.test_context_manager_async_with @ linux-x86_64
356356
test.test_asyncio.test_pep492.LockTests.test_context_manager_with_await @ linux-x86_64
357+
test.test_asyncio.test_pep492.StreamReaderTests.test_readline @ linux-x86_64
357358
test.test_asyncio.test_proactor_events.BaseProactorEventLoopTests.test_close @ linux-x86_64
358359
test.test_asyncio.test_proactor_events.BaseProactorEventLoopTests.test_close_self_pipe @ linux-x86_64
359360
test.test_asyncio.test_proactor_events.BaseProactorEventLoopTests.test_create_server @ linux-x86_64
@@ -481,6 +482,7 @@ test.test_asyncio.test_queues.QueuePutTests.test_put_cancelled_race @ linux-x86_
481482
test.test_asyncio.test_queues.QueuePutTests.test_put_with_waiting_getters @ linux-x86_64
482483
test.test_asyncio.test_queues.QueuePutTests.test_why_are_putters_waiting @ linux-x86_64
483484
test.test_asyncio.test_runners.RunTests.test_asyncio_run_cancels_hanging_tasks @ linux-x86_64
485+
test.test_asyncio.test_runners.RunTests.test_asyncio_run_closes_gens_after_hanging_tasks_errors @ linux-x86_64
484486
test.test_asyncio.test_runners.RunTests.test_asyncio_run_debug @ linux-x86_64
485487
test.test_asyncio.test_runners.RunTests.test_asyncio_run_from_running_loop @ linux-x86_64
486488
test.test_asyncio.test_runners.RunTests.test_asyncio_run_loop_factory @ linux-x86_64
@@ -820,6 +822,7 @@ test.test_asyncio.test_subprocess.SubprocessThreadedWatcherTests.test_subprocess
820822
test.test_asyncio.test_subprocess.SubprocessThreadedWatcherTests.test_terminate @ linux-x86_64
821823
test.test_asyncio.test_subprocess.SubprocessTransportTests.test_proc_exited @ linux-x86_64
822824
test.test_asyncio.test_subprocess.SubprocessTransportTests.test_subprocess_repr @ linux-x86_64
825+
test.test_asyncio.test_taskgroups.TestTaskGroup.test_cancel_children_on_child_error @ linux-x86_64
823826
test.test_asyncio.test_taskgroups.TestTaskGroup.test_cancellation @ linux-x86_64
824827
test.test_asyncio.test_taskgroups.TestTaskGroup.test_exception_refcycles_base_error @ linux-x86_64
825828
test.test_asyncio.test_taskgroups.TestTaskGroup.test_exception_refcycles_direct @ linux-x86_64
@@ -829,7 +832,13 @@ test.test_asyncio.test_taskgroups.TestTaskGroup.test_taskgroup_02 @ linux-x86_64
829832
test.test_asyncio.test_taskgroups.TestTaskGroup.test_taskgroup_03 @ linux-x86_64
830833
test.test_asyncio.test_taskgroups.TestTaskGroup.test_taskgroup_04 @ linux-x86_64
831834
test.test_asyncio.test_taskgroups.TestTaskGroup.test_taskgroup_07 @ linux-x86_64
835+
test.test_asyncio.test_taskgroups.TestTaskGroup.test_taskgroup_08 @ linux-x86_64
836+
test.test_asyncio.test_taskgroups.TestTaskGroup.test_taskgroup_09 @ linux-x86_64
837+
test.test_asyncio.test_taskgroups.TestTaskGroup.test_taskgroup_10 @ linux-x86_64
838+
test.test_asyncio.test_taskgroups.TestTaskGroup.test_taskgroup_11 @ linux-x86_64
839+
test.test_asyncio.test_taskgroups.TestTaskGroup.test_taskgroup_12 @ linux-x86_64
832840
test.test_asyncio.test_taskgroups.TestTaskGroup.test_taskgroup_13 @ linux-x86_64
841+
test.test_asyncio.test_taskgroups.TestTaskGroup.test_taskgroup_14 @ linux-x86_64
833842
test.test_asyncio.test_taskgroups.TestTaskGroup.test_taskgroup_15 @ linux-x86_64
834843
test.test_asyncio.test_taskgroups.TestTaskGroup.test_taskgroup_16 @ linux-x86_64
835844
test.test_asyncio.test_taskgroups.TestTaskGroup.test_taskgroup_17 @ linux-x86_64
@@ -937,11 +946,13 @@ test.test_asyncio.test_tasks.PyTask_PyFuture_SubclassTests.test_create_task_with
937946
test.test_asyncio.test_tasks.PyTask_PyFuture_SubclassTests.test_create_task_with_noncoroutine @ linux-x86_64
938947
test.test_asyncio.test_tasks.PyTask_PyFuture_SubclassTests.test_current_task @ linux-x86_64
939948
test.test_asyncio.test_tasks.PyTask_PyFuture_SubclassTests.test_current_task_with_interleaving_tasks @ linux-x86_64
949+
test.test_asyncio.test_tasks.PyTask_PyFuture_SubclassTests.test_ensure_future_awaitable @ linux-x86_64
940950
test.test_asyncio.test_tasks.PyTask_PyFuture_SubclassTests.test_ensure_future_coroutine @ linux-x86_64
941951
test.test_asyncio.test_tasks.PyTask_PyFuture_SubclassTests.test_ensure_future_error_msg @ linux-x86_64
942952
test.test_asyncio.test_tasks.PyTask_PyFuture_SubclassTests.test_ensure_future_future @ linux-x86_64
943953
test.test_asyncio.test_tasks.PyTask_PyFuture_SubclassTests.test_ensure_future_neither @ linux-x86_64
944954
test.test_asyncio.test_tasks.PyTask_PyFuture_SubclassTests.test_ensure_future_task @ linux-x86_64
955+
test.test_asyncio.test_tasks.PyTask_PyFuture_SubclassTests.test_ensure_future_task_awaitable @ linux-x86_64
945956
test.test_asyncio.test_tasks.PyTask_PyFuture_SubclassTests.test_exception_chaining_after_await @ linux-x86_64
946957
test.test_asyncio.test_tasks.PyTask_PyFuture_SubclassTests.test_exception_chaining_after_await_with_context_cycle @ linux-x86_64
947958
test.test_asyncio.test_tasks.PyTask_PyFuture_SubclassTests.test_exception_traceback @ linux-x86_64
@@ -1042,11 +1053,13 @@ test.test_asyncio.test_tasks.PyTask_PyFuture_Tests.test_create_task_with_asyncli
10421053
test.test_asyncio.test_tasks.PyTask_PyFuture_Tests.test_create_task_with_noncoroutine @ linux-x86_64
10431054
test.test_asyncio.test_tasks.PyTask_PyFuture_Tests.test_current_task @ linux-x86_64
10441055
test.test_asyncio.test_tasks.PyTask_PyFuture_Tests.test_current_task_with_interleaving_tasks @ linux-x86_64
1056+
test.test_asyncio.test_tasks.PyTask_PyFuture_Tests.test_ensure_future_awaitable @ linux-x86_64
10451057
test.test_asyncio.test_tasks.PyTask_PyFuture_Tests.test_ensure_future_coroutine @ linux-x86_64
10461058
test.test_asyncio.test_tasks.PyTask_PyFuture_Tests.test_ensure_future_error_msg @ linux-x86_64
10471059
test.test_asyncio.test_tasks.PyTask_PyFuture_Tests.test_ensure_future_future @ linux-x86_64
10481060
test.test_asyncio.test_tasks.PyTask_PyFuture_Tests.test_ensure_future_neither @ linux-x86_64
10491061
test.test_asyncio.test_tasks.PyTask_PyFuture_Tests.test_ensure_future_task @ linux-x86_64
1062+
test.test_asyncio.test_tasks.PyTask_PyFuture_Tests.test_ensure_future_task_awaitable @ linux-x86_64
10501063
test.test_asyncio.test_tasks.PyTask_PyFuture_Tests.test_exception_chaining_after_await @ linux-x86_64
10511064
test.test_asyncio.test_tasks.PyTask_PyFuture_Tests.test_exception_chaining_after_await_with_context_cycle @ linux-x86_64
10521065
test.test_asyncio.test_tasks.PyTask_PyFuture_Tests.test_exception_traceback @ linux-x86_64

graalpython/com.oracle.graal.python.test/src/tests/unittest_tags_bytecode_dsl/test_collections.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ test.test_collections.TestNamedTuple.test_pickle @ linux-x86_64
8383
test.test_collections.TestNamedTuple.test_readonly @ linux-x86_64
8484
test.test_collections.TestNamedTuple.test_repr @ linux-x86_64
8585
test.test_collections.TestNamedTuple.test_tupleness @ linux-x86_64
86+
test.test_collections.TestOneTrickPonyABCs.test_AsyncIterable @ linux-x86_64
87+
test.test_collections.TestOneTrickPonyABCs.test_AsyncIterator @ linux-x86_64
8688
test.test_collections.TestOneTrickPonyABCs.test_Callable @ linux-x86_64
8789
test.test_collections.TestOneTrickPonyABCs.test_Collection @ linux-x86_64
8890
test.test_collections.TestOneTrickPonyABCs.test_Container @ linux-x86_64

graalpython/com.oracle.graal.python.test/src/tests/unittest_tags_bytecode_dsl/test_compile.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ test.test_compile.TestSpecifics.test_stack_overflow @ linux-x86_64
5151
test.test_compile.TestSpecifics.test_subscripts @ linux-x86_64
5252
test.test_compile.TestSpecifics.test_syntax_error @ linux-x86_64
5353
test.test_compile.TestSpecifics.test_unary_minus @ linux-x86_64
54-
test.test_compile.TestStackSizeStability.test_async_for @ linux-x86_64
55-
test.test_compile.TestStackSizeStability.test_async_for_else @ linux-x86_64
5654
test.test_compile.TestStackSizeStability.test_if @ linux-x86_64
5755
test.test_compile.TestStackSizeStability.test_if_else @ linux-x86_64
5856
test.test_compile.TestStackSizeStability.test_while_else @ linux-x86_64

graalpython/com.oracle.graal.python.test/src/tests/unittest_tags_bytecode_dsl/test_contextlib_async.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,27 @@
11
test.test_contextlib_async.AclosingTestCase.test_aclosing @ linux-x86_64
2+
test.test_contextlib_async.AclosingTestCase.test_aclosing_bpo41229 @ linux-x86_64
23
test.test_contextlib_async.AclosingTestCase.test_aclosing_error @ linux-x86_64
34
test.test_contextlib_async.AclosingTestCase.test_instance_docs @ linux-x86_64
45
test.test_contextlib_async.AsyncContextManagerTestCase.test_contextmanager_attribs @ linux-x86_64
56
test.test_contextlib_async.AsyncContextManagerTestCase.test_contextmanager_doc_attrib @ linux-x86_64
7+
test.test_contextlib_async.AsyncContextManagerTestCase.test_contextmanager_except @ linux-x86_64
8+
test.test_contextlib_async.AsyncContextManagerTestCase.test_contextmanager_except_stopiter @ linux-x86_64
9+
test.test_contextlib_async.AsyncContextManagerTestCase.test_contextmanager_finally @ linux-x86_64
10+
test.test_contextlib_async.AsyncContextManagerTestCase.test_contextmanager_no_reraise @ linux-x86_64
11+
test.test_contextlib_async.AsyncContextManagerTestCase.test_contextmanager_non_normalised @ linux-x86_64
12+
test.test_contextlib_async.AsyncContextManagerTestCase.test_contextmanager_plain @ linux-x86_64
13+
test.test_contextlib_async.AsyncContextManagerTestCase.test_contextmanager_traceback @ linux-x86_64
14+
test.test_contextlib_async.AsyncContextManagerTestCase.test_contextmanager_trap_no_yield @ linux-x86_64
15+
test.test_contextlib_async.AsyncContextManagerTestCase.test_contextmanager_trap_second_yield @ linux-x86_64
16+
test.test_contextlib_async.AsyncContextManagerTestCase.test_contextmanager_trap_yield_after_throw @ linux-x86_64
17+
test.test_contextlib_async.AsyncContextManagerTestCase.test_contextmanager_wrap_runtimeerror @ linux-x86_64
18+
test.test_contextlib_async.AsyncContextManagerTestCase.test_decorating_method @ linux-x86_64
19+
test.test_contextlib_async.AsyncContextManagerTestCase.test_decorator @ linux-x86_64
20+
test.test_contextlib_async.AsyncContextManagerTestCase.test_decorator_with_exception @ linux-x86_64
21+
test.test_contextlib_async.AsyncContextManagerTestCase.test_instance_docstring_given_cm_docstring @ linux-x86_64
22+
test.test_contextlib_async.AsyncContextManagerTestCase.test_keywords @ linux-x86_64
23+
test.test_contextlib_async.AsyncContextManagerTestCase.test_recursive @ linux-x86_64
24+
test.test_contextlib_async.TestAbstractAsyncContextManager.test_async_gen_propagates_generator_exit @ linux-x86_64
625
test.test_contextlib_async.TestAbstractAsyncContextManager.test_enter @ linux-x86_64
726
test.test_contextlib_async.TestAbstractAsyncContextManager.test_exit_is_abstract @ linux-x86_64
827
test.test_contextlib_async.TestAbstractAsyncContextManager.test_structural_subclassing @ linux-x86_64

0 commit comments

Comments
 (0)