This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: zipfile: add missing "pwd: expected bytes, got str" exception message
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.11
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: dhillier, lukasz.langa, serhiy.storchaka, twouters
Priority: normal Keywords: patch

Created on 2020-01-16 13:20 by dhillier, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18031 merged dhillier, 2020-01-16 13:47
Messages (6)
msg360118 - (view) Author: Daniel Hillier (dhillier) * Date: 2020-01-16 13:20
Setting the ZipFile.pwd attribute directly skips the check to ensure the password is a bytes object and, if not, return a user friendly TypeError("pwd: expected bytes, got <type>") informing them of that.
msg402530 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-23 21:37
New changeset 91099e25446b214725f8e2ffffbec6f90553260c by Daniel Hillier in branch 'main':
bpo-39359: [zipfile] add missing "pwd: expected bytes, got str" exception (GH-18031)
msg402531 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-09-23 21:38
Thanks, Daniel! ✨ 🍰 ✨
msg402539 - (view) Author: Daniel Hillier (dhillier) * Date: 2021-09-23 23:01
Thanks Łukasz!
msg402702 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-09-27 12:00
Why do you set the ZipFile.pwd attribute directly?
msg402705 - (view) Author: Daniel Hillier (dhillier) * Date: 2021-09-27 12:45
I agree it is bad form but I would accidentally do it when I couldn't remember the proper API and took a stab in the dark without looking up the docs. I unfortunately used it in an example in the docs for pyzipper and started getting a few bug reports even after fixing my docs.
Date User Action Args
2022-04-11 14:59:25adminsetgithub: 83540
2021-09-27 12:45:59dhilliersetmessages: + msg402705
2021-09-27 12:00:29serhiy.storchakasetmessages: + msg402702
2021-09-23 23:01:06dhilliersetmessages: + msg402539
2021-09-23 21:38:18lukasz.langasetstatus: open -> closed
versions: + Python 3.11, - Python 3.7, Python 3.8, Python 3.9
messages: + msg402531

resolution: fixed
stage: patch review -> resolved
2021-09-23 21:37:57lukasz.langasetnosy: + lukasz.langa
messages: + msg402530
2020-05-29 12:36:25cheryl.sabellasetnosy: + twouters, serhiy.storchaka
2020-01-16 13:47:03dhilliersetkeywords: + patch
stage: patch review
pull_requests: + pull_request17427
2020-01-16 13:20:14dhilliercreate