[issue41672] imaplib: wrong return type documented

2020-08-31 Thread Norbert Cyran

New submission from Norbert Cyran :

Documentation on IMAP4 class specifies wrong return type of its commands:

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).

That's not valid for Python 3, as IMAP4 commands return bytes-like objects in 
data, what's shown in the example before::
  >>> from imaplib import IMAP4
  >>> with IMAP4("domain.org") as M:
  ... M.noop()
  ...
  ('OK', [b'Nothing Accomplished. d25if65hy903weo.87'])

That of course can cause a lot of trouble due to incompatibility of strings and 
bytes. Suggested change is to replace string occurences to bytes-like object. I 
don't know what types are returned in case when tuple is returned though.

--
assignee: docs@python
components: Documentation
messages: 376143
nosy: docs@python, norbertcyran
priority: normal
severity: normal
status: open
title: imaplib: wrong return type documented
versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 
<https://bugs.python.org/issue41672>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41672] imaplib: wrong return type documented

2020-09-06 Thread Norbert Cyran


Norbert Cyran  added the comment:

@ericsmith

Sure, I can create a PR and link it here when I'm done.

--

___
Python tracker 
<https://bugs.python.org/issue41672>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41672] imaplib: wrong return type documented

2020-09-11 Thread Norbert Cyran


Change by Norbert Cyran :


--
keywords: +patch
pull_requests: +21261
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22207

___
Python tracker 
<https://bugs.python.org/issue41672>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41672] imaplib: wrong return type documented

2020-09-11 Thread Norbert Cyran


Norbert Cyran  added the comment:

@corona10 PR added: https://github.com/python/cpython/pull/22207

--

___
Python tracker 
<https://bugs.python.org/issue41672>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com