]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-39606: allow closing async generators that are already closed (GH-18475) (GH...
authorNathaniel J. Smith <njs@pobox.com>
Thu, 13 Feb 2020 09:33:35 +0000 (01:33 -0800)
committerGitHub <noreply@github.com>
Thu, 13 Feb 2020 09:33:35 +0000 (01:33 -0800)
commitf464edf3239f7867fe31c9cd238a68fb3b90feaa
tree7fc4c0663fafff1350d4b43060eea181f3eaafb4
parentca133e53fafdec1aa77613fcb7558deed959383f
bpo-39606: allow closing async generators that are already closed (GH-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:
  https://github.com/python-trio/trio/pull/1396

https://bugs.python.org/issue39606
(cherry picked from commit 925dc7fb1d0db85dc137afa4cd14211bf0d67414)
Lib/test/test_asyncgen.py
Misc/NEWS.d/next/Core and Builtins/2020-02-11-23-59-07.bpo-39606.a72Sxc.rst [new file with mode: 0644]
Objects/genobject.c