python3Packages.aioimaplib: patch test code to work on python 3.14

Filed https://github.com/iroco-co/aioimaplib/issues/125
This commit is contained in:
Sarah Clark
2026-01-15 09:13:34 -08:00
parent ce23c4de14
commit 17b8e71cb3
2 changed files with 30 additions and 0 deletions
@@ -24,6 +24,11 @@ buildPythonPackage rec {
hash = "sha256-njzSpKPis033eLoRKXL538ljyMOB43chslio1wodrKU=";
};
patches = [
# https://github.com/iroco-co/aioimaplib/issues/125
./event-loop.patch
];
build-system = [ poetry-core ];
nativeCheckInputs = [
@@ -0,0 +1,25 @@
diff --git a/aioimaplib/imap_testing_server.py b/aioimaplib/imap_testing_server.py
index b303aa3..419b808 100644
--- a/aioimaplib/imap_testing_server.py
+++ b/aioimaplib/imap_testing_server.py
@@ -198,12 +198,18 @@ class ImapProtocol(asyncio.Protocol):
DEFAULT_QUOTA = 5000
def __init__(self, server_state, fetch_chunk_size=0, capabilities=CAPABILITIES,
- loop=asyncio.get_event_loop()):
+ loop=None):
self.uidvalidity = int(datetime.now().timestamp())
self.capabilities = capabilities
self.state_to_send = list()
self.delay_seconds = 0
- self.loop = loop
+ if loop is None:
+ try:
+ self.loop = asyncio.get_running_loop()
+ except RuntimeError:
+ self.loop = asyncio.new_event_loop()
+ else:
+ self.loop = loop
self.fetch_chunk_size = fetch_chunk_size
self.transport = None
self.server_state = server_state