From 112ee3834070b578b3fe796fb25fc73e3471eb20 Mon Sep 17 00:00:00 2001 From: carlitogwapito <20962552+carlitogwapito@users.noreply.github.com> Date: Sat, 17 Oct 2026 10:46:44 -0600 Subject: [PATCH] docs: qualify pathlib subclassing comparison by Python version --- README.rst | 9 ++++----- newsfragments/+readme-pathlib-subclassing.bugfix.rst | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 newsfragments/+readme-pathlib-subclassing.bugfix.rst diff --git a/README.rst b/README.rst index fdea155..cc7f093 100644 --- a/README.rst +++ b/README.rst @@ -85,11 +85,10 @@ has several advantages over ``pathlib``: and encouraged. - ``path`` provides superior portability using a uniform abstraction over its single Path object, - freeing the implementer to subclass it readily. One cannot - subclass a ``pathlib.Path`` to add functionality, but must - subclass ``Path``, ``PosixPath``, and ``WindowsPath``, even - to do something as simple as to add a ``__dict__`` to the subclass - instances. ``path`` instead allows the ``Path.module`` + freeing the implementer to subclass it readily. ``pathlib.Path`` supports + direct subclassing on `Python 3.12 and later + `_. + ``path`` allows the ``Path.module`` object to be overridden by subclasses, defaulting to the ``os.path``. Even advanced uses of ``path.Path`` that subclass the model do not need to be concerned with diff --git a/newsfragments/+readme-pathlib-subclassing.bugfix.rst b/newsfragments/+readme-pathlib-subclassing.bugfix.rst new file mode 100644 index 0000000..63e031e --- /dev/null +++ b/newsfragments/+readme-pathlib-subclassing.bugfix.rst @@ -0,0 +1 @@ +Clarify that direct subclassing of ``pathlib.Path`` is supported on Python 3.12 and later.