Commit d74a402
gh-40038: Quote imaplib command arguments when necessary
Argument quoting was inadvertently disabled when imaplib was ported to
Python 3 (bpo-1210 commented out the ``_checkquote()`` call, bpo-9638
then removed it), so since Python 3.0 commands failed for arguments
containing protocol-sensitive characters, such as a space in a mailbox
name.
Quoting is restored and reimplemented per the RFC 3501 grammar, so that
arguments that need quoting are escaped and quoted, while flags, sequence
sets and list wildcards are left intact.
For backward compatibility, an argument already enclosed in double quotes
is left unchanged, so code that quotes arguments itself keeps working.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent ddb6539 commit d74a402
4 files changed
Lines changed: 355 additions & 52 deletions
File tree
- Doc/library
- Lib
- test
- Misc/NEWS.d/next/Library
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
189 | 192 | | |
190 | 193 | | |
191 | 194 | | |
| |||
410 | 413 | | |
411 | 414 | | |
412 | 415 | | |
413 | | - | |
| 416 | + | |
414 | 417 | | |
415 | 418 | | |
416 | 419 | | |
| |||
440 | 443 | | |
441 | 444 | | |
442 | 445 | | |
443 | | - | |
| 446 | + | |
444 | 447 | | |
445 | 448 | | |
446 | 449 | | |
| |||
0 commit comments