From b8d08a8a980693233db124a17db33a500addf428 Mon Sep 17 00:00:00 2001 From: Dick Marinus Date: Thu, 29 May 2025 08:11:49 +0200 Subject: [PATCH] Python 3.14 fixes --- .github/workflows/test.yml | 2 +- alot/__main__.py | 6 ++++-- alot/ui.py | 3 +-- tests/utilities.py | 3 +-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 56345807..b899108f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.14.0-beta.2"] steps: - uses: actions/checkout@v4 diff --git a/alot/__main__.py b/alot/__main__.py index 21f85be5..aa5904a8 100644 --- a/alot/__main__.py +++ b/alot/__main__.py @@ -6,6 +6,7 @@ import locale import logging import os import sys +import asyncio import alot from alot.settings.const import settings @@ -18,7 +19,8 @@ from alot.commands import CommandParseError, COMMANDS from alot.utils import argparse as cargparse from twisted.internet import asyncioreactor -asyncioreactor.install() +EVENT_LOOP = asyncio.new_event_loop() +asyncioreactor.install(EVENT_LOOP) _SUBCOMMANDS = ['search', 'compose', 'bufferlist', 'taglist', 'namedqueries', @@ -137,7 +139,7 @@ def main(): cmdstring = ' '.join(options.command) # set up and start interface - UI(dbman, cmdstring) + UI(dbman, cmdstring, EVENT_LOOP) # run the exit hook exit_hook = settings.get_hook('exit') diff --git a/alot/ui.py b/alot/ui.py index edc01010..4c44809a 100644 --- a/alot/ui.py +++ b/alot/ui.py @@ -44,7 +44,7 @@ class UI: responsible for opening, closing and focussing buffers. """ - def __init__(self, dbman, initialcmdline): + def __init__(self, dbman, initialcmdline, loop): """ :param dbman: :class:`~alot.db.DBManager` :param initialcmdline: commandline applied after setting up interface @@ -121,7 +121,6 @@ class UI: unhandled_input=self._unhandled_input, input_filter=self._input_filter) - loop = asyncio.get_event_loop() # Create a task for the periodic hook loop_hook = settings.get_hook('loop_hook') if loop_hook: diff --git a/tests/utilities.py b/tests/utilities.py index 671fe574..809951f6 100644 --- a/tests/utilities.py +++ b/tests/utilities.py @@ -185,7 +185,6 @@ def async_test(coro): @functools.wraps(coro) def _actual(*args, **kwargs): - loop = asyncio.get_event_loop() - return loop.run_until_complete(coro(*args, **kwargs)) + asyncio.run(coro(*args, **kwargs)) return _actual -- 2.49.0