FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.15] gh-40038: Quote imaplib command arguments when necessary (GH-152703) by serhiy-storchaka · Pull Request #153066 · python/cpython · GitHub

/ cpython Public

[3.15] gh-40038: Quote imaplib command arguments when necessary (GH-152703) - #153066

Merged
serhiy-storchaka merged 1 commit into
python:3.15from
serhiy-storchaka:backport-600e864-3.15
Jul 5, 2026
Merged

[3.15] gh-40038: Quote imaplib command arguments when necessary (GH-152703)#153066
serhiy-storchaka merged 1 commit into
python:3.15from
serhiy-storchaka:backport-600e864-3.15

Conversation

serhiy-storchaka commented Jul 5, 2026
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

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. (cherry picked from commit 600e864)

…pythonGH-152703)

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.
(cherry picked from commit 600e864)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copy link
Copy Markdown

serhiy-storchaka merged commit 2c99ec4 into python:3.15 Jul 5, 2026
61 checks passed

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

Copy link
Copy Markdown

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 2c99ec4388f6bc4e09eb095b3caf2e1b4466c108 3.14

Copy link
Copy Markdown

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 2c99ec4388f6bc4e09eb095b3caf2e1b4466c108 3.13

serhiy-storchaka removed needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Jul 5, 2026
serhiy-storchaka removed their assignment Jul 5, 2026
serhiy-storchaka deleted the backport-600e864-3.15 branch July 15, 2026 11:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL