Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zipfile: add missing "pwd: expected bytes, got str" exception message #83540

Closed
danifus mannequin opened this issue Jan 16, 2020 · 6 comments
Closed

zipfile: add missing "pwd: expected bytes, got str" exception message #83540

danifus mannequin opened this issue Jan 16, 2020 · 6 comments
Labels
3.11 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@danifus
Copy link
Mannequin

danifus mannequin commented Jan 16, 2020

BPO 39359
Nosy @Yhg1s, @ambv, @serhiy-storchaka, @danifus
PRs
  • bpo-39359, zipfile: add missing "pwd: expected bytes, got str" exception #18031
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-09-23.21:38:18.710>
    created_at = <Date 2020-01-16.13:20:14.781>
    labels = ['type-feature', 'library', '3.11']
    title = 'zipfile: add missing "pwd: expected bytes, got str" exception message'
    updated_at = <Date 2021-09-27.12:45:59.826>
    user = 'https://github.com/danifus'

    bugs.python.org fields:

    activity = <Date 2021-09-27.12:45:59.826>
    actor = 'dhillier'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-09-23.21:38:18.710>
    closer = 'lukasz.langa'
    components = ['Library (Lib)']
    creation = <Date 2020-01-16.13:20:14.781>
    creator = 'dhillier'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 39359
    keywords = ['patch']
    message_count = 6.0
    messages = ['360118', '402530', '402531', '402539', '402702', '402705']
    nosy_count = 4.0
    nosy_names = ['twouters', 'lukasz.langa', 'serhiy.storchaka', 'dhillier']
    pr_nums = ['18031']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue39359'
    versions = ['Python 3.11']

    @danifus
    Copy link
    Mannequin Author

    danifus mannequin commented Jan 16, 2020

    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.

    @danifus danifus mannequin added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Jan 16, 2020
    @ambv
    Copy link
    Contributor

    ambv commented Sep 23, 2021

    New changeset 91099e2 by Daniel Hillier in branch 'main':
    bpo-39359: [zipfile] add missing "pwd: expected bytes, got str" exception (GH-18031)
    91099e2

    @ambv
    Copy link
    Contributor

    ambv commented Sep 23, 2021

    Thanks, Daniel! ✨ 🍰 ✨

    @ambv ambv added 3.11 only security fixes and removed 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes labels Sep 23, 2021
    @ambv ambv closed this as completed Sep 23, 2021
    @ambv ambv removed 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes labels Sep 23, 2021
    @ambv ambv closed this as completed Sep 23, 2021
    @danifus
    Copy link
    Mannequin Author

    danifus mannequin commented Sep 23, 2021

    Thanks Łukasz!

    @serhiy-storchaka
    Copy link
    Member

    Why do you set the ZipFile.pwd attribute directly?

    @danifus
    Copy link
    Mannequin Author

    danifus mannequin commented Sep 27, 2021

    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.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants