[proxy] github.com← back | site home | direct (HTTPS) ↗ | proxy home | ◑ dark◐ light

bpo-39606: allow closing async generators that are already closed by njsmith · Pull Request #18475 · python/cpython

njsmith

The fix for bpo-39386 attempted to make it so you couldn't reuse a
agen.aclose() coroutine object. It accidentally also prevented you
from calling aclose() at all on an async generator that was already
closed or exhausted. This commit fixes it so we're only blocking the
actually illegal cases, while allowing the legal cases.

The new tests failed before this patch. Also confirmed that this fixes
the test failures we were seeing in Trio with Python dev builds:
  python-trio/trio#1396

Closed

Merged

1st1 approved these changes Feb 12, 2020

njsmith added a commit that referenced this pull request

Feb 13, 2020

…-18475) (GH-18502)

The fix for [bpo-39386](https://bugs.python.org/issue39386) attempted to make it so you couldn't reuse a
agen.aclose() coroutine object. It accidentally also prevented you
from calling aclose() at all on an async generator that was already
closed or exhausted. This commit fixes it so we're only blocking the
actually illegal cases, while allowing the legal cases.

The new tests failed before this patch. Also confirmed that this fixes
the test failures we were seeing in Trio with Python dev builds:
  python-trio/trio#1396

https://bugs.python.org/issue39606
(cherry picked from commit 925dc7f)