2 Commits

Author SHA256 Message Date
d9a7a00ae0 Accepting request 1315327 from devel:languages:python
Forwarded request #1315240 from mgrossu

- Add python314-compatibility.patch:
    * Fix python3.14 compatibiliy by adjusting pathlib.PurePath.relative_to() call and guarding removed asyncio.get_child_watcher() API

OBS-URL: https://build.opensuse.org/request/show/1315327
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-anyio3?expand=0&rev=3
2025-11-03 17:56:29 +00:00
822bafedc4 - Add python314-compatibility.patch:
* Fix python3.14 compatibiliy by adjusting pathlib.PurePath.relative_to() call and guarding removed asyncio.get_child_watcher() API

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-anyio3?expand=0&rev=5
2025-11-03 14:35:38 +00:00
3 changed files with 65 additions and 1 deletions

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Nov 3 07:19:47 UTC 2025 - Marius Grossu <marius.grossu@suse.com>
- Add python314-compatibility.patch:
* Fix python3.14 compatibiliy by adjusting pathlib.PurePath.relative_to() call and guarding removed asyncio.get_child_watcher() API
-------------------------------------------------------------------
Mon Apr 1 11:12:45 UTC 2024 - Ben Greiner <code@bnavigator.de>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-anyio3
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -26,6 +26,7 @@ URL: https://github.com/agronholm/anyio
Source: https://files.pythonhosted.org/packages/source/a/anyio/anyio-%{version}.tar.gz
# PATCH-FIX-UPSTREAM see gh#agronholm/anyio#626
Patch2: tests-test_fileio.py-don-t-follow-symlinks-in-dev.patch
Patch3: python314-compatibility.patch
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module exceptiongroup if %python-base < 3.11}
BuildRequires: %{python_module idna >= 2.8}

View File

@@ -0,0 +1,57 @@
Index: anyio-3.7.1/src/anyio/_backends/_asyncio.py
===================================================================
--- anyio-3.7.1.orig/src/anyio/_backends/_asyncio.py
+++ anyio-3.7.1/src/anyio/_backends/_asyncio.py
@@ -1061,9 +1061,21 @@ def _forcibly_shutdown_process_pool_on_e
Forcibly shuts down worker processes belonging to this event loop."""
child_watcher: asyncio.AbstractChildWatcher | None
try:
- child_watcher = asyncio.get_event_loop_policy().get_child_watcher()
- except NotImplementedError:
+ policy = asyncio.get_event_loop_policy()
+ if hasattr(policy, "get_child_watcher"):
+ child_watcher = policy.get_child_watcher()
+ except (AttributeError, NotImplementedError):
child_watcher = None
+
+ # If watcher still exists, make remove_child_handler safe
+ def _safe_remove(pid: int) -> None:
+ if not child_watcher:
+ return
+ try:
+ if hasattr(child_watcher, "remove_child_handler"):
+ child_watcher.remove_child_handler(pid)
+ except Exception:
+ pass
# Close as much as possible (w/o async/await) to avoid warnings
for process in workers:
@@ -1076,6 +1088,7 @@ def _forcibly_shutdown_process_pool_on_e
process.kill()
if child_watcher:
child_watcher.remove_child_handler(process.pid)
+ _safe_remove(process.pid)
async def _shutdown_process_pool_on_exit(workers: set[Process]) -> None:
Index: anyio-3.7.1/src/anyio/_core/_fileio.py
===================================================================
--- anyio-3.7.1.orig/src/anyio/_core/_fileio.py
+++ anyio-3.7.1/src/anyio/_core/_fileio.py
@@ -506,7 +506,15 @@ class Path:
return await to_thread.run_sync(self._path.read_text, encoding, errors)
def relative_to(self, *other: str | PathLike[str]) -> Path:
- return Path(self._path.relative_to(*other))
+ # Python 3.14 compatibility: pathlib.PurePath.relative_to no longer accepts multiple arguments
+ if len(other) == 1:
+ rel = self._path.relative_to(other[0])
+ else:
+ rel = self._path
+ for p in other:
+ rel = rel.relative_to(p)
+ return Path(rel)
+
async def readlink(self) -> Path:
target = await to_thread.run_sync(os.readlink, self._path)