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

quopri: encodestring and decodestring handle bytes, not strings #59793

Closed
patrickvrijlandt mannequin opened this issue Aug 8, 2012 · 8 comments
Closed

quopri: encodestring and decodestring handle bytes, not strings #59793

patrickvrijlandt mannequin opened this issue Aug 8, 2012 · 8 comments
Labels
docs Documentation in the Doc dir stdlib Python modules in the Lib dir topic-email type-bug An unexpected behavior, bug, or error

Comments

@patrickvrijlandt
Copy link
Mannequin

patrickvrijlandt mannequin commented Aug 8, 2012

BPO 15588
Nosy @warsaw, @orsenthil, @bitdancer, @akheron
Files
  • issue15588.patch
  • 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 2014-06-25.08:14:51.380>
    created_at = <Date 2012-08-08.07:30:58.878>
    labels = ['type-bug', 'library', 'expert-email', 'docs']
    title = 'quopri: encodestring and decodestring handle bytes, not strings'
    updated_at = <Date 2014-06-25.08:14:51.346>
    user = 'https://bugs.python.org/patrickvrijlandt'

    bugs.python.org fields:

    activity = <Date 2014-06-25.08:14:51.346>
    actor = 'orsenthil'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2014-06-25.08:14:51.380>
    closer = 'orsenthil'
    components = ['Documentation', 'Library (Lib)', 'email']
    creation = <Date 2012-08-08.07:30:58.878>
    creator = 'patrick.vrijlandt'
    dependencies = []
    files = ['26886']
    hgrepos = []
    issue_num = 15588
    keywords = ['patch', 'needs review']
    message_count = 8.0
    messages = ['167672', '168502', '221054', '221077', '221460', '221475', '221534', '221535']
    nosy_count = 8.0
    nosy_names = ['barry', 'orsenthil', 'r.david.murray', 'docs@python', 'BreamoreBoy', 'python-dev', 'patrick.vrijlandt', 'petri.lehtinen']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue15588'
    versions = ['Python 3.4', 'Python 3.5']

    @patrickvrijlandt
    Copy link
    Mannequin Author

    patrickvrijlandt mannequin commented Aug 8, 2012

    quopri.py's functions encodestring and decodestring are documented to handle strings; and this is clearly suggested by their name. However, these functions accept and return bytes, not strings. This should be reflected in the documentation.

    Even better: deprecate these functions and introduce new ones with behaviour as suggested by their names: encode_string, encode_bytes etc.

    @patrickvrijlandt patrickvrijlandt mannequin added stdlib Python modules in the Lib dir docs Documentation in the Doc dir type-bug An unexpected behavior, bug, or error labels Aug 8, 2012
    @akheron
    Copy link
    Member

    akheron commented Aug 18, 2012

    The encode() and decode() functions also expect binary file objects.

    Attached a patch that changes documentation and docstrings. Removed the mentions of readline(), because read() is called on input instead, if the binascii module is available. Also removed the repeated descriptions of quotetabs and header in encodestring()'s docs.

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Jun 20, 2014

    Can we have a review on this fairly small patch please.

    @bitdancer
    Copy link
    Member

    Please do review it, Mark.

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Jun 24, 2014

    Just one small query on the patch (more for my own benefit than anything else). In the rst file there's now no difference between the wording for the quotetabs positional argument to encode and the keyword argument to encodestring. Is there a rule (of thumb) that covers this situation? Other than that LGTM.

    @bitdancer
    Copy link
    Member

    No, that's a good catch. For a keyword argument, we generally do mention the default value in the text, and it looks like we still should in that instance, especially since it *is* different that it is a keyword argument and not positional like the method to which the text is giving a back-reference.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 25, 2014

    New changeset b4130b2f7748 by Senthil Kumaran in branch 'default':
    merge from 3.4
    http://hg.python.org/cpython/rev/b4130b2f7748

    @orsenthil
    Copy link
    Member

    Thanks for the review, Mark. Addressed that and committed the changes in changeset 606a18938476 (3.4)
    changeset b4130b2f7748 (3.5)

    @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
    docs Documentation in the Doc dir stdlib Python modules in the Lib dir topic-email type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants