Skip to content

Conversation

@savanto
Copy link

@savanto savanto commented Dec 27, 2025

According to the docstring for append:

(typ, [data]) = <instance>.append(mailbox, flags, date_time, message)

Python v3.0
Python v3.14

Further corroborated that this is a tuple because append returns the result of self._simple_command(...), which returns the result of self._command_complete(...), which returns typ, data.

From something like this

with IMAP4_SSL(...) as imap:
    imap.login(...)
    (status, data) = imap.append(...)

I'm getting a Mypy (v1.17.1) type error:

error: Unpacking a string is disallowed  [misc]

when in practice unpacking the tuple works just fine.

According to the docstring for append:
```
(typ, [data]) = <instance>.append(mailbox, flags, date_time, message)
```
[v3.0](https://github.com/python/cpython/blob/v3.0/Lib/imaplib.py#L313)
[v3.14](https://github.com/python/cpython/blob/v3.14.0/Lib/imaplib.py#L483)

Further corroborated that this is a tuple of some sort because append
returns the result of `self._simple_command(...)`, which returns the
result of `self._command_complete(...)`, which returns `typ, data`.
@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@savanto savanto marked this pull request as ready for review December 27, 2025 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant