diff --git a/docs/versionhistory.rst b/docs/versionhistory.rst index e697cc2b..61c0f6ed 100644 --- a/docs/versionhistory.rst +++ b/docs/versionhistory.rst @@ -8,6 +8,7 @@ This library adheres to `Semantic Versioning 2.0 `_. - Added ``stdin`` argument to ``anyio.run_process()`` akin to what ``anyio.open_process()``, ``asyncio.create_subprocess_…()``, ``trio.run_process()``, and ``subprocess.run()`` already accept (PR by @jmehnle) +- Added the ``info`` property to ``anyio.Path`` on Python 3.14 - Fixed traceback formatting growing quadratically with level of ``TaskGroup`` nesting on asyncio due to exception chaining when raising ``ExceptionGroups`` in ``TaskGroup.__aexit__`` diff --git a/src/anyio/_core/_fileio.py b/src/anyio/_core/_fileio.py index 3728734c..350a873a 100644 --- a/src/anyio/_core/_fileio.py +++ b/src/anyio/_core/_fileio.py @@ -232,14 +232,15 @@ class Path: * :meth:`~pathlib.Path.copy` (available on Python 3.14 or later) * :meth:`~pathlib.Path.copy_into` (available on Python 3.14 or later) * :meth:`~pathlib.Path.from_uri` (available on Python 3.13 or later) - * :meth:`~pathlib.Path.full_match` (available on Python 3.13 or later) + * :meth:`~pathlib.PurePath.full_match` (available on Python 3.13 or later) + * :attr:`~pathlib.Path.info` (available on Python 3.14 or later) * :meth:`~pathlib.Path.is_junction` (available on Python 3.12 or later) - * :meth:`~pathlib.Path.match` (the ``case_sensitive`` parameter is only available on - Python 3.13 or later) + * :meth:`~pathlib.PurePath.match` (the ``case_sensitive`` parameter is only + available on Python 3.13 or later) * :meth:`~pathlib.Path.move` (available on Python 3.14 or later) * :meth:`~pathlib.Path.move_into` (available on Python 3.14 or later) - * :meth:`~pathlib.Path.relative_to` (the ``walk_up`` parameter is only available on - Python 3.12 or later) + * :meth:`~pathlib.PurePath.relative_to` (the ``walk_up`` parameter is only available + on Python 3.12 or later) * :meth:`~pathlib.Path.walk` (available on Python 3.12 or later) Any methods that do disk I/O need to be awaited on. These methods are: @@ -411,6 +412,10 @@ def match(self, path_pattern: str) -> bool: if sys.version_info >= (3, 14): + @property + def info(self) -> Any: # TODO: add return type annotation when Typeshed gets it + return self._path.info + async def copy( self, target: str | os.PathLike[str], diff --git a/tests/test_fileio.py b/tests/test_fileio.py index d7a769bd..28830e6e 100644 --- a/tests/test_fileio.py +++ b/tests/test_fileio.py @@ -106,6 +106,8 @@ async def test_properties(self) -> None: stdlib_properties.discard("__enter__") stdlib_properties.discard("__exit__") stdlib_properties.discard("__firstlineno__") + stdlib_properties.discard("__open_rb__") + stdlib_properties.discard("__open_wb__") async_path = Path(path) anyio_properties = {