]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.8] bpo-39606: allow closing async generators that are already closed (GH-18475...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 13 Feb 2020 08:43:23 +0000 (00:43 -0800)
committerGitHub <noreply@github.com>
Thu, 13 Feb 2020 08:43:23 +0000 (00:43 -0800)
commit8dbdf5f275c6462bb522bcf3a29054239d72989d
tree6c0836e87e8f69904d215c2e19723d8e0a617724
parenta00b5be5f71b702ab80b0a7c046485046aaae160
[3.8] bpo-39606: allow closing async generators that are already closed (GH-18475) (GH-18501)

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)

Co-authored-by: Nathaniel J. Smith <njs@pobox.com>
https://bugs.python.org/issue39606

Automerge-Triggered-By: @njsmith
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