8000 gh-71189: Support all-but-last mode in os.path.realpath() by serhiy-storchaka · Pull Request #117562 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-71189: Support all-but-last mode in os.path.realpath() #117562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Documentation.
  • Loading branch information
serhiy-storchaka committed May 20, 2025
commit db9e13b49b100c955c2e96db11cb7e407afd495e
12 changes: 12 additions & 0 deletions Doc/library/os.path.rst
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ the :mod:`glob` module.)
If a path doesn't exist or a symlink loop is encountered, and *strict* is
``True``, :exc:`OSError` is raised. If *strict* is ``False`` these errors
are ignored, and so the result might be missing or otherwise inaccessible.
If *strict* is :data:`ALL_BUT_LAST`, the last component of the path
might be missing, but other errors are not ignored.

.. note::
This function emulates the operating system's procedure for making a path
Expand All @@ -429,6 +431,16 @@ the :mod:`glob` module.)
.. versionchanged:: 3.10
The *strict* parameter was added.

.. versionchanged:: next
Support for :data:`ALL_BUT_LAST` was added.


.. data:: ALL_BUT_LAST

Special value used for *strict* in :func:`realpath`.

.. versionadded:: next


.. function:: relpath(path, start=os.curdir)

Expand Down
6 changes: 6 additions & 0 deletions Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ New modules
Improved modules
================

os.path
-------

* Add support of the all-but-last mode in :func:`~os.path.realpath`.
(Contributed by Serhiy Storchaka in :gh:`71189`.)

ssl
---

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support of the all-but-last mode in :func:`os.path.realpath`.
0