@@ -251,7 +251,8 @@ ZipFile Objects
251
251
Access a member of the archive as a binary file-like object. *name *
252
252
can be either the name of a file within the archive or a :class: `ZipInfo `
253
253
object. The *mode * parameter, if included, must be ``'r' `` (the default)
254
- or ``'w' ``. *pwd * is the password used to decrypt encrypted ZIP files.
254
+ or ``'w' ``. *pwd * is the password used to decrypt encrypted ZIP files as a
255
+ :class: `bytes ` object.
255
256
256
257
:meth: `~ZipFile.open ` is also a context manager and therefore supports the
257
258
:keyword: `with ` statement::
@@ -303,7 +304,7 @@ ZipFile Objects
303
304
must be its full name or a :class: `ZipInfo ` object. Its file information is
304
305
extracted as accurately as possible. *path * specifies a different directory
305
306
to extract to. *member * can be a filename or a :class: `ZipInfo ` object.
306
- *pwd * is the password used for encrypted files.
307
+ *pwd * is the password used for encrypted files as a :class: ` bytes ` object .
307
308
308
309
Returns the normalized path created (a directory or new file).
309
310
@@ -330,7 +331,7 @@ ZipFile Objects
330
331
Extract all members from the archive to the current working directory. *path *
331
332
specifies a different directory to extract to. *members * is optional and must
332
333
be a subset of the list returned by :meth: `namelist `. *pwd * is the password
333
- used for encrypted files.
334
+ used for encrypted files as a :class: ` bytes ` object .
334
335
335
336
.. warning ::
336
337
@@ -355,16 +356,16 @@ ZipFile Objects
355
356
356
357
.. method :: ZipFile.setpassword(pwd)
357
358
358
- Set *pwd * as default password to extract encrypted files.
359
+ Set *pwd * (a :class: ` bytes ` object) as default password to extract encrypted files.
359
360
360
361
361
362
.. method :: ZipFile.read(name, pwd=None)
362
363
363
364
Return the bytes of the file *name * in the archive. *name * is the name of the
364
365
file in the archive, or a :class: `ZipInfo ` object. The archive must be open for
365
- read or append. *pwd * is the password used for encrypted files and, if specified,
366
- it will override the default password set with :meth: `setpassword `. Calling
367
- :meth: `read ` on a ZipFile that uses a compression method other than
366
+ read or append. *pwd * is the password used for encrypted files as a :class: ` bytes `
367
+ object and, if specified, overrides the default password set with :meth: `setpassword `.
368
+ Calling :meth: `read ` on a ZipFile that uses a compression method other than
368
369
:const: `ZIP_STORED `, :const: `ZIP_DEFLATED `, :const: `ZIP_BZIP2 ` or
369
370
:const: `ZIP_LZMA ` will raise a :exc: `NotImplementedError `. An error will also
370
371
be raised if the corresponding compression module is not available.
0 commit comments