]> git.ipfire.org Git - thirdparty/tornado.git/commit
web: Improve typing for UIModule.render
authorBen Darnell <ben@bendarnell.com>
Fri, 7 Jun 2024 19:23:45 +0000 (15:23 -0400)
committerBen Darnell <ben@bendarnell.com>
Fri, 7 Jun 2024 19:23:45 +0000 (15:23 -0400)
commit4337efe236168d0b8b73188abb6944976ce5394a
treefa39a4c8c1bc62fad7c6e0c77d08ebbe62cc49d7
parent70dc6f73fb9b130e9e548b62b3ff9ff2a8a9e870
web: Improve typing for UIModule.render

In practice, UIModule.render often returns the
result of self.render_string, which returns bytes.
In fact, we have an example of that in this file
which had a type ignore comment. UIModule.render
may now return either str or bytes and downstream
code is responsible for handling this. (Note that
the new call to _unicode appears to be redundant
since the Template module's bytes return was
already working correctly, but this conversion is
necessary to satisfy the type checker.)

Fixes #3050
tornado/web.py