]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[doc] bpo-43066: zipfile - add note on leading slash in the filename arg (GH-26899)
authorandrei kulakov <andrei.avk@gmail.com>
Wed, 4 Aug 2021 19:34:34 +0000 (15:34 -0400)
committerGitHub <noreply@github.com>
Wed, 4 Aug 2021 19:34:34 +0000 (21:34 +0200)
Co-authored-by: Ɓukasz Langa <lukasz@langa.pl>
Doc/library/zipfile.rst
Misc/NEWS.d/next/Documentation/2021-06-24-14-37-16.bpo-43066.Ti7ahX.rst [new file with mode: 0644]

index 19a67ab694cb9695318b162b413d4d83ac177067..a0bbdbf595aa8cd5208cc3e974886a1bf476ae0b 100644 (file)
@@ -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 (file)
index 0000000..3e38522
--- /dev/null
@@ -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.