[Python-checkins] [doc] bpo-43066: zipfile - add note on leading slash in the filename arg (GH-26899)

miss-islington webhook-mailer at python.org
Wed Aug 4 15:59:12 EDT 2021


https://github.com/python/cpython/commit/98f6a72ff621c2033e8f2c38df410e9bfa2b772a
commit: 98f6a72ff621c2033e8f2c38df410e9bfa2b772a
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2021-08-04T12:59:04-07:00
summary:

[doc] bpo-43066: zipfile - add note on leading slash in the filename arg (GH-26899)


Co-authored-by: Łukasz Langa <lukasz at langa.pl>
(cherry picked from commit 7c5dab4340032eb15d3797d8b601ef11649bbab3)

Co-authored-by: andrei kulakov <andrei.avk at gmail.com>

files:
A Misc/NEWS.d/next/Documentation/2021-06-24-14-37-16.bpo-43066.Ti7ahX.rst
M Doc/library/zipfile.rst

diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst
index 3db55e646c47cc..4888838db2c4b2 100644
--- a/Doc/library/zipfile.rst
+++ b/Doc/library/zipfile.rst
@@ -78,7 +78,6 @@ The module defines the following items:
    of the last modification to the file; the fields are described in section
    :ref:`zipinfo-objects`.
 
-
 .. function:: is_zipfile(filename)
 
    Returns ``True`` if *filename* is a valid ZIP file based on its magic number,
@@ -406,6 +405,11 @@ ZipFile Objects
       If ``arcname`` (or ``filename``, if ``arcname`` is  not given) contains a null
       byte, the name of the file in the archive will be truncated at the null byte.
 
+   .. note::
+
+      A leading slash in the filename may lead to the archive being impossible to
+      open in some zip programs on Windows systems.
+
    .. versionchanged:: 3.6
       Calling :meth:`write` on a ZipFile created with mode ``'r'`` or
       a closed ZipFile will raise a :exc:`ValueError`.  Previously,
diff --git a/Misc/NEWS.d/next/Documentation/2021-06-24-14-37-16.bpo-43066.Ti7ahX.rst b/Misc/NEWS.d/next/Documentation/2021-06-24-14-37-16.bpo-43066.Ti7ahX.rst
new file mode 100644
index 00000000000000..3e38522839e8be
--- /dev/null
+++ b/Misc/NEWS.d/next/Documentation/2021-06-24-14-37-16.bpo-43066.Ti7ahX.rst
@@ -0,0 +1,2 @@
+Added a warning to :mod:`zipfile` docs: filename arg with a leading slash may cause archive to
+be un-openable on Windows systems.



More information about the Python-checkins mailing list