KEMBAR78
GH-117536: ensure asyncgens GCd before runner teardown get aclosed by graingert · Pull Request #117577 · python/cpython · GitHub
Skip to content

Conversation

@graingert
Copy link
Contributor

@graingert graingert commented Apr 6, 2024

@graingert
Copy link
Contributor Author

some tests needed:

  • an async gen getting GCd during teardown can call await asyncio.sleep(0) without raising GeneratorExit
  • an async gen getting GCd after shutdown_asyncgens is called can call await asyncio.sleep(0) without getting GeneratorExit


if not len(self._asyncgens):
closing_agens = list(self._asyncgens)
closing_agens.extend(self._closing_asyncgens.copy())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
closing_agens.extend(self._closing_asyncgens.copy())
closing_agens.extend(self._closing_asyncgens)

@graingert
Copy link
Contributor Author

My original diagnosis of the problem was wrong, async gens .aclose() get cancelled but still scheduled

@graingert graingert closed this Apr 10, 2024
@graingert graingert deleted the ensure-asyncgens-gcd-before-runner-teardown-get-aclosed branch April 10, 2024 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants