From 6aae36b1d20986ca0cadb084aaf48180f98eb446 Mon Sep 17 00:00:00 2001 From: erentar Date: Sat, 21 Feb 2026 23:10:34 +0100 Subject: [PATCH] Fix #82: update behaviour of event_loop.py to accomodate changes in python 3.14 --- matlab_proxy/util/event_loop.py | 10 +++++++++- pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/matlab_proxy/util/event_loop.py b/matlab_proxy/util/event_loop.py index 97b259fd..17917529 100644 --- a/matlab_proxy/util/event_loop.py +++ b/matlab_proxy/util/event_loop.py @@ -25,7 +25,15 @@ def get_event_loop(): # If execution reached this except block, it implies that there # was no running event loop. So, create one. if system.is_posix(): - loop = asyncio.get_event_loop() + try: + # Creates loop before python <=3.13, + # fails with RuntimeError for greater versions + loop = asyncio.get_event_loop() + except RuntimeError: + # For python versions >=3.14: + # create the loop and set it as the current event loop + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) else: loop = windows.get_event_loop() diff --git a/pyproject.toml b/pyproject.toml index df806ee6..576d775c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ description = "Python® package enables you to launch MATLAB® and access it fro readme = "README.md" license = "LicenseRef-MATHWORKS-CLOUD-REFERENCE-ARCHITECTURE-LICENSE" license-files = ["LICENSE.md"] -requires-python = ">=3.10, <3.14" +requires-python = ">=3.10, <3.15" authors = [ { name = "The MathWorks Inc.", email = "cloud@mathworks.com" }, ]