diff --git a/docs/versionhistory.rst b/docs/versionhistory.rst
index 29ac38d9..397b5495 100644
--- a/docs/versionhistory.rst
+++ b/docs/versionhistory.rst
@@ -13,6 +13,10 @@ This library adheres to `Semantic Versioning 2.0 `_.
- Fixed ``TypeError`` with ``TLSStream`` on Windows when a certificate verification
error occurs when using a `truststore `_
SSL certificate (`#795 `_)
+- Corrected documentation on ``anyio.Path`` regarding the limitations imposed by the
+ current Python version on several of its methods, and made the ``is_junction`` method
+ unavailable on Python versions earlier than 3.12
+ (`#794 `_)
**4.6.0**
diff --git a/src/anyio/_core/_fileio.py b/src/anyio/_core/_fileio.py
index 9503d944..214a90bf 100644
--- a/src/anyio/_core/_fileio.py
+++ b/src/anyio/_core/_fileio.py
@@ -218,6 +218,18 @@ class Path:
It implements the Python 3.10 version of :class:`pathlib.Path` interface, except for
the deprecated :meth:`~pathlib.Path.link_to` method.
+ Some methods may be unavailable or have limited functionality, based on the Python
+ version:
+
+ * :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.Path.is_junction` (available on Python 3.12 or later)
+ * :meth:`~pathlib.Path.match` (the ``case_sensitive`` paramater is only available on
+ Python 3.13 or later)
+ * :meth:`~pathlib.Path.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:
* :meth:`~pathlib.Path.absolute`
@@ -233,7 +245,10 @@ class Path:
* :meth:`~pathlib.Path.is_dir`
* :meth:`~pathlib.Path.is_fifo`
* :meth:`~pathlib.Path.is_file`
+ * :meth:`~pathlib.Path.is_junction`
* :meth:`~pathlib.Path.is_mount`
+ * :meth:`~pathlib.Path.is_socket`
+ * :meth:`~pathlib.Path.is_symlink`
* :meth:`~pathlib.Path.lchmod`
* :meth:`~pathlib.Path.lstat`
* :meth:`~pathlib.Path.mkdir`
@@ -244,11 +259,14 @@ class Path:
* :meth:`~pathlib.Path.readlink`
* :meth:`~pathlib.Path.rename`
* :meth:`~pathlib.Path.replace`
+ * :meth:`~pathlib.Path.resolve`
* :meth:`~pathlib.Path.rmdir`
* :meth:`~pathlib.Path.samefile`
* :meth:`~pathlib.Path.stat`
+ * :meth:`~pathlib.Path.symlink_to`
* :meth:`~pathlib.Path.touch`
* :meth:`~pathlib.Path.unlink`
+ * :meth:`~pathlib.Path.walk`
* :meth:`~pathlib.Path.write_bytes`
* :meth:`~pathlib.Path.write_text`
@@ -386,9 +404,6 @@ def is_relative_to(self, other: str | PathLike[str]) -> bool:
except ValueError:
return False
- async def is_junction(self) -> bool:
- return await to_thread.run_sync(self._path.is_junction)
-
async def chmod(self, mode: int, *, follow_symlinks: bool = True) -> None:
func = partial(os.chmod, follow_symlinks=follow_symlinks)
return await to_thread.run_sync(func, self._path, mode)
@@ -448,6 +463,11 @@ async def is_fifo(self) -> bool:
async def is_file(self) -> bool:
return await to_thread.run_sync(self._path.is_file, abandon_on_cancel=True)
+ if sys.version_info >= (3, 12):
+
+ async def is_junction(self) -> bool:
+ return await to_thread.run_sync(self._path.is_junction)
+
async def is_mount(self) -> bool:
return await to_thread.run_sync(
os.path.ismount, self._path, abandon_on_cancel=True