Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] support/scripts/pkg-stats: fix RuntimeError with python 3.14 asyncio
@ 2026-01-25 12:29 Julien Olivain via buildroot
  2026-02-02 15:46 ` Vincent Fazio
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Julien Olivain via buildroot @ 2026-01-25 12:29 UTC (permalink / raw)
  To: buildroot; +Cc: Sen Hastings, Julien Olivain

When running "make pkg-stats" on a host with Python 3.14 (e.g.
Fedora 43 for example), the execution fails with the error:

    Checking URL status
    Traceback (most recent call last):
      File "/buildroot/support/scripts/pkg-stats", line 1387, in <module>
        __main__()
        ~~~~~~~~^^
      File "/buildroot/support/scripts/pkg-stats", line 1368, in __main__
        loop = asyncio.get_event_loop()
      File "/usr/lib64/python3.14/asyncio/events.py", line 715, in get_event_loop
        raise RuntimeError('There is no current event loop in thread %r.'
                           % threading.current_thread().name)
    RuntimeError: There is no current event loop in thread 'MainThread'.

This is due to a breaking change introduced in Python 3.14
asyncio.get_event_loop(). See [1]. Before Python 3.14, this call was
creating and setting an event loop if there was none. This situation
is now a runtime error.

In order to fix this issue with newer Python version, while keeping
backward compatibility, this commit replaces the code:

    loop = asyncio.get_event_loop()

by an explicit event loop creation:

    loop = asyncio.new_event_loop()
    asyncio.set_event_loop(loop)

This commit was tested on a Fedora 43 host with Python-3.14.2, and
with the Buildroot Docker image plus the python3-aiohttp package
which is a Debian 12 with Python-3.11.2.

[1] https://docs.python.org/3.14/library/asyncio-eventloop.html#asyncio.get_event_loop

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
 support/scripts/pkg-stats | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
index 7d9170e30f..d2d36257d9 100755
--- a/support/scripts/pkg-stats
+++ b/support/scripts/pkg-stats
@@ -1365,11 +1365,13 @@ def __main__():
         pkg.set_developers(developers)
     if "url" not in args.disable:
         print("Checking URL status")
-        loop = asyncio.get_event_loop()
+        loop = asyncio.new_event_loop()
+        asyncio.set_event_loop(loop)
         loop.run_until_complete(check_package_urls(packages, verbose=args.verbose))
     if "upstream" not in args.disable:
         print("Getting latest versions ...")
-        loop = asyncio.get_event_loop()
+        loop = asyncio.new_event_loop()
+        asyncio.set_event_loop(loop)
         loop.run_until_complete(check_package_latest_version(packages, verbose=args.verbose))
     if "cve" not in args.disable and args.nvd_path:
         print("Checking packages CVEs")
-- 
2.52.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH 1/1] support/scripts/pkg-stats: fix RuntimeError with python 3.14 asyncio
  2026-01-25 12:29 [Buildroot] [PATCH 1/1] support/scripts/pkg-stats: fix RuntimeError with python 3.14 asyncio Julien Olivain via buildroot
@ 2026-02-02 15:46 ` Vincent Fazio
  2026-02-04  8:26 ` Thomas Petazzoni via buildroot
  2026-02-13 19:37 ` Thomas Perale via buildroot
  2 siblings, 0 replies; 4+ messages in thread
From: Vincent Fazio @ 2026-02-02 15:46 UTC (permalink / raw)
  To: Julien Olivain, buildroot@buildroot.org; +Cc: Sen Hastings



> -----Original Message-----
> From: buildroot <buildroot-bounces@buildroot.org> On Behalf Of Julien
> Olivain via buildroot
> Sent: Sunday, January 25, 2026 6:30 AM
> To: buildroot@buildroot.org
> Cc: Sen Hastings <sen@hastings.org>; Julien Olivain <ju.o@free.fr>
> Subject: [External] - [Buildroot] [PATCH 1/1] support/scripts/pkg-stats: fix
> RuntimeError with python 3.14 asyncio
> 
> When running "make pkg-stats" on a host with Python 3.14 (e.g.
> Fedora 43 for example), the execution fails with the error:
> 
>     Checking URL status
>     Traceback (most recent call last):
>       File "/buildroot/support/scripts/pkg-stats", line 1387, in <module>
>         __main__()
>         ~~~~~~~~^^
>       File "/buildroot/support/scripts/pkg-stats", line 1368, in __main__
>         loop = asyncio.get_event_loop()
>       File "/usr/lib64/python3.14/asyncio/events.py", line 715, in
> get_event_loop
>         raise RuntimeError('There is no current event loop in thread %r.'
>                            % threading.current_thread().name)
>     RuntimeError: There is no current event loop in thread 'MainThread'.
> 
> This is due to a breaking change introduced in Python 3.14
> asyncio.get_event_loop(). See [1]. Before Python 3.14, this call was
> creating and setting an event loop if there was none. This situation
> is now a runtime error.
> 
> In order to fix this issue with newer Python version, while keeping
> backward compatibility, this commit replaces the code:
> 
>     loop = asyncio.get_event_loop()
> 
> by an explicit event loop creation:
> 
>     loop = asyncio.new_event_loop()
>     asyncio.set_event_loop(loop)
> 
> This commit was tested on a Fedora 43 host with Python-3.14.2, and
> with the Buildroot Docker image plus the python3-aiohttp package
> which is a Debian 12 with Python-3.11.2.

Should we add `python3-aiohttp` to the Dockerfile (in a separate patch)?

> 
> [1] https://docs.python.org/3.14/library/asyncio-
> eventloop.html#asyncio.get_event_loop
> 
> Signed-off-by: Julien Olivain <ju.o@free.fr>

Tested-by: Vincent Fazio <vfazio@xes-inc.com>

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH 1/1] support/scripts/pkg-stats: fix RuntimeError with python 3.14 asyncio
  2026-01-25 12:29 [Buildroot] [PATCH 1/1] support/scripts/pkg-stats: fix RuntimeError with python 3.14 asyncio Julien Olivain via buildroot
  2026-02-02 15:46 ` Vincent Fazio
@ 2026-02-04  8:26 ` Thomas Petazzoni via buildroot
  2026-02-13 19:37 ` Thomas Perale via buildroot
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2026-02-04  8:26 UTC (permalink / raw)
  To: Julien Olivain; +Cc: buildroot, Sen Hastings

Hello,

On Sun, Jan 25, 2026 at 01:29:38PM +0100, Julien Olivain via buildroot wrote:
> When running "make pkg-stats" on a host with Python 3.14 (e.g.
> Fedora 43 for example), the execution fails with the error:

Thanks for the patch, applied!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH 1/1] support/scripts/pkg-stats: fix RuntimeError with python 3.14 asyncio
  2026-01-25 12:29 [Buildroot] [PATCH 1/1] support/scripts/pkg-stats: fix RuntimeError with python 3.14 asyncio Julien Olivain via buildroot
  2026-02-02 15:46 ` Vincent Fazio
  2026-02-04  8:26 ` Thomas Petazzoni via buildroot
@ 2026-02-13 19:37 ` Thomas Perale via buildroot
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Perale via buildroot @ 2026-02-13 19:37 UTC (permalink / raw)
  To: Julien Olivain; +Cc: Thomas Perale, buildroot

In reply of:
> When running "make pkg-stats" on a host with Python 3.14 (e.g.
> Fedora 43 for example), the execution fails with the error:
> 
>     Checking URL status
>     Traceback (most recent call last):
>       File "/buildroot/support/scripts/pkg-stats", line 1387, in <module>
>         __main__()
>         ~~~~~~~~^^
>       File "/buildroot/support/scripts/pkg-stats", line 1368, in __main__
>         loop = asyncio.get_event_loop()
>       File "/usr/lib64/python3.14/asyncio/events.py", line 715, in get_event_loop
>         raise RuntimeError('There is no current event loop in thread %r.'
>                            % threading.current_thread().name)
>     RuntimeError: There is no current event loop in thread 'MainThread'.
> 
> This is due to a breaking change introduced in Python 3.14
> asyncio.get_event_loop(). See [1]. Before Python 3.14, this call was
> creating and setting an event loop if there was none. This situation
> is now a runtime error.
> 
> In order to fix this issue with newer Python version, while keeping
> backward compatibility, this commit replaces the code:
> 
>     loop = asyncio.get_event_loop()
> 
> by an explicit event loop creation:
> 
>     loop = asyncio.new_event_loop()
>     asyncio.set_event_loop(loop)
> 
> This commit was tested on a Fedora 43 host with Python-3.14.2, and
> with the Buildroot Docker image plus the python3-aiohttp package
> which is a Debian 12 with Python-3.11.2.
> 
> [1] https://docs.python.org/3.14/library/asyncio-eventloop.html#asyncio.get_event_loop
> 
> Signed-off-by: Julien Olivain <ju.o@free.fr>

Applied to 2025.02.x & 2025.11.x. Thanks

> ---
>  support/scripts/pkg-stats | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
> index 7d9170e30f..d2d36257d9 100755
> --- a/support/scripts/pkg-stats
> +++ b/support/scripts/pkg-stats
> @@ -1365,11 +1365,13 @@ def __main__():
>          pkg.set_developers(developers)
>      if "url" not in args.disable:
>          print("Checking URL status")
> -        loop = asyncio.get_event_loop()
> +        loop = asyncio.new_event_loop()
> +        asyncio.set_event_loop(loop)
>          loop.run_until_complete(check_package_urls(packages, verbose=args.verbose))
>      if "upstream" not in args.disable:
>          print("Getting latest versions ...")
> -        loop = asyncio.get_event_loop()
> +        loop = asyncio.new_event_loop()
> +        asyncio.set_event_loop(loop)
>          loop.run_until_complete(check_package_latest_version(packages, verbose=args.verbose))
>      if "cve" not in args.disable and args.nvd_path:
>          print("Checking packages CVEs")
> -- 
> 2.52.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-13 19:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-25 12:29 [Buildroot] [PATCH 1/1] support/scripts/pkg-stats: fix RuntimeError with python 3.14 asyncio Julien Olivain via buildroot
2026-02-02 15:46 ` Vincent Fazio
2026-02-04  8:26 ` Thomas Petazzoni via buildroot
2026-02-13 19:37 ` Thomas Perale via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox