This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: UTF-7 codec decodes ill-formed sequences starting with "+"
Type: behavior Stage: resolved
Components: Interpreter Core, Unicode Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ZackerySpytz, ezio.melotti, jwilk, lemburg, loewis, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2014-10-10 12:44 by jwilk, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 8741 merged ZackerySpytz, 2018-08-12 05:54
Messages (5)
msg228996 - (view) Author: Jakub Wilk (jwilk) Date: 2014-10-10 12:44
RFC 2152 reads:

  A "+" character followed immediately by any character other than
  members of set B or "-" is an ill-formed sequence.

"@" is not a member of B, so I would expect this to raise UnicodeDecodeError:

>>> b'+@'.decode('UTF-7')
'@'
msg323431 - (view) Author: Zackery Spytz (ZackerySpytz) * (Python triager) Date: 2018-08-12 05:57
This was also mentioned in #24848.
msg323444 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-08-12 15:04
What about a "+" character followed immediately by the end of the bytestring?

>>> b'+'.decode('utf-7')
''
msg323742 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-08-19 04:43
New changeset e349bf23584eef20e0d1e1b2989d9b1430f15507 by Serhiy Storchaka (Zackery Spytz) in branch 'master':
bpo-22602: Raise an exception in the UTF-7 decoder for ill-formed sequences starting with "+". (GH-8741)
https://github.com/python/cpython/commit/e349bf23584eef20e0d1e1b2989d9b1430f15507
msg323743 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-08-19 04:44
Thank you for your PR Zackery.
History
Date User Action Args
2022-04-11 14:58:08adminsetgithub: 66792
2018-08-19 04:44:28serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg323743

stage: patch review -> resolved
2018-08-19 04:43:41serhiy.storchakasetmessages: + msg323742
2018-08-12 15:04:29serhiy.storchakasetmessages: + msg323444
2018-08-12 05:57:56ZackerySpytzsetnosy: + ZackerySpytz

messages: + msg323431
versions: + Python 3.8, - Python 2.7, Python 3.4, Python 3.5
2018-08-12 05:54:20ZackerySpytzsetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request8226
2014-10-10 14:42:07serhiy.storchakasetnosy: + ezio.melotti, lemburg, loewis, vstinner, serhiy.storchaka
stage: needs patch

components: + Interpreter Core, Unicode, - Library (Lib)
versions: + Python 2.7, Python 3.4, Python 3.5
2014-10-10 12:44:43jwilkcreate