]> git.ipfire.org Git - thirdparty/tornado.git/commit
Fix ValueError in file_uploader.py by converting @gen.coroutine to async/await 3523/head
authorQuaylyn Rimer <quaylynrimer11@gmail.com>
Mon, 28 Jul 2025 02:45:49 +0000 (20:45 -0600)
committerQuaylyn Rimer <quaylynrimer11@gmail.com>
Mon, 28 Jul 2025 02:45:49 +0000 (20:45 -0600)
commita6e7dc9f8ab95732f5327c9a3ea30af060100ee6
tree5ede5b9c76a300a652fd3515b81039c3f48e3dd4
parent37417f8d4db9d9fbdebe90c85a85b530b8659542
Fix ValueError in file_uploader.py by converting @gen.coroutine to async/await

Fixes #3182

The file_uploader.py demo was failing with ValueError when trying to upload files
because @gen.coroutine decorated functions return tornado.concurrent.Future objects,
but asyncio.run() expects native coroutines.

This change converts the @gen.coroutine decorated functions to native async/await
syntax, which is the modern recommended approach and resolves the compatibility
issue with asyncio.run().

Changes:
- Remove tornado.gen import
- Convert @gen.coroutine decorators to async def
- Convert all yield statements to await
- Maintains backward compatibility with existing Tornado versions
demos/file_upload/file_uploader.py