Skip to content

Commit 98f6a72

Browse files
[doc] bpo-43066: zipfile - add note on leading slash in the filename arg (GH-26899)
Co-authored-by: Łukasz Langa <[email protected]> (cherry picked from commit 7c5dab4) Co-authored-by: andrei kulakov <[email protected]>
1 parent cdcae41 commit 98f6a72

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Doc/library/zipfile.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ The module defines the following items:
7878
of the last modification to the file; the fields are described in section
7979
:ref:`zipinfo-objects`.
8080

81-
8281
.. function:: is_zipfile(filename)
8382

8483
Returns ``True`` if *filename* is a valid ZIP file based on its magic number,
@@ -406,6 +405,11 @@ ZipFile Objects
406405
If ``arcname`` (or ``filename``, if ``arcname`` is not given) contains a null
407406
byte, the name of the file in the archive will be truncated at the null byte.
408407

408+
.. note::
409+
410+
A leading slash in the filename may lead to the archive being impossible to
411+
open in some zip programs on Windows systems.
412+
409413
.. versionchanged:: 3.6
410414
Calling :meth:`write` on a ZipFile created with mode ``'r'`` or
411415
a closed ZipFile will raise a :exc:`ValueError`. Previously,
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Added a warning to :mod:`zipfile` docs: filename arg with a leading slash may cause archive to
2+
be un-openable on Windows systems.

0 commit comments

Comments
 (0)