summaryrefslogtreecommitdiffstats
path: root/Misc/NEWS.d/next
diff options
context:
space:
mode:
authorBarney Gale <barney.gale@gmail.com>2024-11-13 22:59:32 (GMT)
committerGitHub <noreply@github.com>2024-11-13 22:59:32 (GMT)
commitfd4b5453df74e249987553b12c14ad75fafa4991 (patch)
treebffc6a81cdd6a05b097468aedf6b9206944d61eb /Misc/NEWS.d/next
parentc695e37a3f95c225ee08d1e882d23fa200b5ec34 (diff)
downloadcpython-fd4b5453df74e249987553b12c14ad75fafa4991.zip
cpython-fd4b5453df74e249987553b12c14ad75fafa4991.tar.gz
cpython-fd4b5453df74e249987553b12c14ad75fafa4991.tar.bz2
GH-118289: Fix handling of non-directories in `posixpath.realpath()` (#120127)
In strict mode, raise `NotADirectoryError` if we encounter a non-directory while we still have path parts left to process. We use a `part_count` variable rather than `len(rest)` because the `rest` stack also contains markers for unresolved symlinks.
Diffstat (limited to 'Misc/NEWS.d/next')
-rw-r--r--Misc/NEWS.d/next/Library/2024-06-05-19-09-36.gh-issue-118289.moL9_d.rst2
1 files changed, 2 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2024-06-05-19-09-36.gh-issue-118289.moL9_d.rst b/Misc/NEWS.d/next/Library/2024-06-05-19-09-36.gh-issue-118289.moL9_d.rst
new file mode 100644
index 0000000..522572e
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2024-06-05-19-09-36.gh-issue-118289.moL9_d.rst
@@ -0,0 +1,2 @@
+:func:`!posixpath.realpath` now raises :exc:`NotADirectoryError` when *strict*
+mode is enabled and a non-directory path with a trailing slash is supplied.