(self)
| 1582 | @cpython_only |
| 1583 | @requires_specialization |
| 1584 | def test_send_with(self): |
| 1585 | def run_async(coro): |
| 1586 | while True: |
| 1587 | try: |
| 1588 | coro.send(None) |
| 1589 | except StopIteration: |
| 1590 | break |
| 1591 | |
| 1592 | class CM: |
| 1593 | async def __aenter__(self): |
| 1594 | return self |
| 1595 | |
| 1596 | async def __aexit__(self, *exc): |
| 1597 | pass |
| 1598 | |
| 1599 | async def send_with(): |
| 1600 | for _ in range(_testinternalcapi.SPECIALIZATION_THRESHOLD): |
| 1601 | async with CM(): |
| 1602 | x = 1 |
| 1603 | |
| 1604 | run_async(send_with()) |
| 1605 | # Note there are still unspecialized "SEND" opcodes in the |
| 1606 | # cleanup paths of the 'with' statement. |
| 1607 | self.assert_specialized(send_with, "SEND_GEN") |
| 1608 | |
| 1609 | @cpython_only |
| 1610 | @requires_specialization |
nothing calls this directly
no test coverage detected