[Python-checkins] bpo-34931: [doc] clarify behavior of os.path.splitext() on paths with multiple leading periods (GH-30347)

iritkatriel webhook-mailer at python.org
Mon Jan 3 15:10:19 EST 2022


https://github.com/python/cpython/commit/51700bf08b0dd4baf998440b2ebfaa488a2855ba
commit: 51700bf08b0dd4baf998440b2ebfaa488a2855ba
branch: main
author: Irit Katriel <1055913+iritkatriel at users.noreply.github.com>
committer: iritkatriel <1055913+iritkatriel at users.noreply.github.com>
date: 2022-01-03T20:10:07Z
summary:

bpo-34931: [doc] clarify behavior of os.path.splitext() on paths with multiple leading periods (GH-30347)

files:
M Doc/library/os.path.rst

diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst
index a66b3c5a3a990..6b15a113f5450 100644
--- a/Doc/library/os.path.rst
+++ b/Doc/library/os.path.rst
@@ -501,11 +501,16 @@ the :mod:`glob` module.)
 
       >>> splitext('foo.bar.exe')
       ('foo.bar', '.exe')
+      >>> splitext('/foo/bar.exe')
+      ('/foo/bar', '.exe')
 
-   Leading periods on the basename are ignored::
+   Leading periods of the last component of the path are considered to
+   be part of the root::
 
       >>> splitext('.cshrc')
       ('.cshrc', '')
+      >>> splitext('/foo/....jpg')
+      ('/foo/....jpg', '')
 
    .. versionchanged:: 3.6
       Accepts a :term:`path-like object`.



More information about the Python-checkins mailing list