Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Python 3.10 shows a deprecation warning when using
asyncio.get_event_loopwhile not in an event loop, which is the case when running the syncrendermethod for an async template. Useasyncio.runinstead, which manages running in an event loop.generateis no longer particularly useful when called on an async template, as callingrunover and over again would create new loops and be inefficient. So it collects the entire render then yields it item by item so that it's still a generator.generatealready doesn't seem particularly useful, as only very simple templates without blocks or other internal buffers will actually yield one statement at a time.I think we should deprecate calling
renderandgenerateif the template is async. It's a blocking call in async mode, and it doesn't really make sense to render an async environment from sync code, as you'd have to manage everything manually for that to be useful. It also requires ignoring some type errors. Users should callrender_asyncfrom a running loop when using an async environment.DeprecationWarning: There is no current event loop#1443Checklist:
CHANGES.rstsummarizing the change and linking to the issue... versionchanged::entries in any relevant code docs.pre-commithooks and fix any issues.pytestandtox, no tests failed.