Bug 2363033 - Python's asyncio create_task is not working with Toga's example application
Summary: Python's asyncio create_task is not working with Toga's example application
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: python3.13
Version: 42
Hardware: Unspecified
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Python Maintainers
QA Contact:
URL: https://github.com/beeware/toga/issue...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-04-30 06:03 UTC by Mauro Carvalho Chehab
Modified: 2025-05-07 12:43 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-05-07 12:43:23 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Mauro Carvalho Chehab 2025-04-30 06:03:41 UTC
With Fedora 41 (Python 3.13.2), using create_task() inside Toga's startup function works fine. After upgrading to Fedora 42 (Python 3.13.3), asyncio now refuses accept create_task(), crashing with:

Traceback (most recent call last):
  File "/home/mchehab/.local/lib/python3.13/site-packages/toga_gtk/app.py", line 53, in gtk_startup
    self.interface._startup()
    ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/mchehab/.local/lib/python3.13/site-packages/toga/app.py", line 630, in _startup
    self.startup()
    ~~~~~~~~~~~~^^
  File "/home/mchehab/bin/a.py", line 77, in startup
    asyncio.create_task(self.do_background_task())
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/asyncio/tasks.py", line 410, in create_task
    task = loop.create_task(coro, name=name)
  File "/usr/lib64/python3.13/asyncio/base_events.py", line 468, in create_task
    return self._task_factory(self, coro, **kwargs)
           ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
TypeError: App._install_task_factory_wrapper.<locals>.factory() got an unexpected keyword argument 'name'

Reproducible: Always

Steps to Reproduce:
1.Install Toga with pip
2.try to run https://github.com/beeware/toga/blob/main/examples/handlers/handlers/app.py
Actual Results:
Python's asyncio crashes with:

TypeError: App._install_task_factory_wrapper.<locals>.factory() got an unexpected keyword argument 'name'

Expected Results:
A GUI window should open

Comment 1 Victor Stinner 2025-05-07 12:27:33 UTC
It seems like the issue was already fixed upstream last week:

* https://github.com/beeware/toga/commit/bdd2e7ba01f801a59a05f02c864ccb0d4e6202b7
* https://github.com/beeware/toga/pull/3395

Comment 2 Miro Hrončok 2025-05-07 12:43:23 UTC
> Python 3.13.3 ensured that the name argument was passed down to task factories; this exposed a bug in Toga's task factory wrapper,

This is not a bug in Python, but in Toga, which you don't install from Fedora.

You need to ask https://github.com/beeware/toga for a new release or install from their github.


Note You need to log in before you can comment on or make changes to this bug.