[New-bugs-announce] [issue39447] imaplib documentation claims that commands return a string, but they return bytes

Daniel Kahn Gillmor report at bugs.python.org
Fri Jan 24 15:24:36 EST 2020


New submission from Daniel Kahn Gillmor <dkg at fifthhorseman.net>:

The imaplib documentation says:


> Each command returns a tuple: (type, [data, ...]) where type is usually 
> 'OK' or 'NO', and data is either the text from the command response, or 
> mandated results from the command. Each data is either a string, or a
> tuple. If a tuple, then the first part is the header of the response, 
> and the second part contains the data (ie: ‘literal’ value).

However, "Each data is either a string, or a tuple" does not appear to be correct.   If the element of data is not a tuple, it appears to be a bytes object, not a string (because it is dealing with network streams of bytes internally)

This is probably old documentation left over from python 2, when strings and bytes were the same.

----------
components: email
messages: 360652
nosy: barry, dkg, r.david.murray
priority: normal
severity: normal
status: open
title: imaplib documentation claims that commands return a string, but they return bytes
type: behavior
versions: Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39447>
_______________________________________


More information about the New-bugs-announce mailing list