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.

classification
Title: quopri: encodestring and decodestring handle bytes, not strings
Type: behavior Stage: resolved
Components: Documentation, email, Library (Lib) Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: BreamoreBoy, barry, docs@python, orsenthil, patrick.vrijlandt, petri.lehtinen, python-dev, r.david.murray
Priority: normal Keywords: needs review, patch

Created on 2012-08-08 07:30 by patrick.vrijlandt, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue15588.patch petri.lehtinen, 2012-08-18 10:25 review
Messages (8)
msg167672 - (view) Author: patrick vrijlandt (patrick.vrijlandt) Date: 2012-08-08 07:30
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.
msg168502 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2012-08-18 10:25
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.
msg221054 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-06-20 00:01
Can we have a review on this fairly small patch please.
msg221077 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-06-20 08:41
Please do review it, Mark.
msg221460 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-06-24 14:43
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.
msg221475 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-06-24 16:19
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.
msg221534 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-06-25 08:13
New changeset b4130b2f7748 by Senthil Kumaran in branch 'default':
merge from 3.4
http://hg.python.org/cpython/rev/b4130b2f7748
msg221535 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2014-06-25 08:14
Thanks for the review, Mark. Addressed that and committed the changes in changeset 606a18938476 (3.4)
changeset b4130b2f7748 (3.5)
History
Date User Action Args
2022-04-11 14:57:34adminsetgithub: 59793
2014-06-25 08:14:51orsenthilsetstatus: open -> closed

versions: + Python 3.5, - Python 3.2, Python 3.3
nosy: + orsenthil

messages: + msg221535
resolution: fixed
stage: patch review -> resolved
2014-06-25 08:13:27python-devsetnosy: + python-dev
messages: + msg221534
2014-06-24 16:19:14r.david.murraysetmessages: + msg221475
2014-06-24 14:43:15BreamoreBoysetmessages: + msg221460
2014-06-20 08:41:03r.david.murraysetmessages: + msg221077
2014-06-20 00:01:05BreamoreBoysetnosy: + BreamoreBoy
messages: + msg221054
2012-08-18 10:25:45petri.lehtinensetfiles: + issue15588.patch

nosy: + petri.lehtinen
messages: + msg168502

keywords: + patch, needs review
stage: patch review
2012-08-08 17:39:56r.david.murraysetnosy: + barry, r.david.murray

components: + email
versions: + Python 3.3, Python 3.4
2012-08-08 07:30:58patrick.vrijlandtcreate