classification
Title: [regression] str.format sublevel format parsing broken in Python 3.3.3
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, benjamin.peterson, eric.smith, georg.brandl, haypo, hct, martin.panter, python-dev, r.david.murray, yselivanov
Priority: release blocker Keywords:

Created on 2013-11-23 02:16 by hct, last changed 2016-02-07 02:40 by python-dev. This issue is now closed.

Messages (10)
msg203954 - (view) Author: HCT (hct) Date: 2013-11-23 02:16
can't find a way around it... maybe a new regression test on this.

Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:18:40) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> "0x{:0{:d}X}".format(0x0,16)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: unmatched '{' in format
>>> "0x{:0{{:d}}X}".format(0x0,16)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Invalid format specifier
>>> "0x{:0{:d}X}".format(0x0,16)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: unmatched '{' in format
>>> "0x{:{:d}X}".format(0x0,16)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: unmatched '{' in format
>>> "0x{:0{:d}X}".format(0x0,16)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: unmatched '{' in format
>>> "0x{:0{:d}x}".format(0x0,16)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: unmatched '{' in format
>>>
>>> "{:0{}x}".format(0,16)
'0000000000000000'

"0x{:0{:d}X}".format(0x0,16) and "{:0{}x}".format(0,16)
work with Python 3.1, 3.2 and up to 3.3.2
msg203962 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2013-11-23 02:40
Amusingly, it also works in 3.4.
msg203963 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2013-11-23 02:56
According to hg bisect, the regression comes from:

changeset:   83817:6786e681ed58
branch:      3.3
parent:      83812:cd2457463eeb
user:        Benjamin Peterson <benjamin@python.org>
date:        Fri May 17 17:34:30 2013 -0500
files:       Lib/test/test_unicode.py Misc/NEWS Objects/stringlib/unicode_format.h
description:
only recursively expand in the format spec (closes #17644)
msg204370 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2013-11-25 17:35
This broke a lot of our code, I think that priority needs to be raised to urgent.
msg204373 - (view) Author: HCT (hct) Date: 2013-11-25 17:42
my projects are total broken by this, so my temporary solution is to down grade to 3.3.2

somehow we don't have any test to check this before releasing 3.3.3
msg204533 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2013-11-26 20:41
Hmm, sucks.

Benjamin, can you come up with a fix?  I'll give it a few weeks to wait for more potential regressions and then do a 3.3.4.
msg204545 - (view) Author: Roundup Robot (python-dev) Date: 2013-11-27 01:24
New changeset bab7dc2ffc16 by Benjamin Peterson in branch '3.3':
fix format spec recursive expansion (closes #19729)
http://hg.python.org/cpython/rev/bab7dc2ffc16

New changeset e27684eed3b6 by Benjamin Peterson in branch 'default':
merge 3.3 (#19729)
http://hg.python.org/cpython/rev/e27684eed3b6
msg204546 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2013-11-27 01:24
Sorry about that.
msg207264 - (view) Author: HCT (hct) Date: 2014-01-04 01:31
just want to know if there is any tentative schedule to release 3.3.4. the PEP for 3.3 schedule doesn't talk about 3.3.4, so I'm not sure if the decision was to leave latest 3.3 with this broken regression or fix it and release 3.3.4.
msg259755 - (view) Author: Roundup Robot (python-dev) Date: 2016-02-07 02:40
New changeset f25d8cbd074a by Martin Panter in branch '3.5':
Issue #25179: Preparatory cleanup of existing docs on string formatting
https://hg.python.org/cpython/rev/f25d8cbd074a

New changeset fe692ee6d19a by Martin Panter in branch '2.7':
Issue #25179: Preparatory cleanup of existing docs on string formatting
https://hg.python.org/cpython/rev/fe692ee6d19a
History
Date User Action Args
2016-02-07 02:40:41python-devsetmessages: + msg259755
2014-01-05 03:59:42martin.pantersetnosy: + martin.panter
2014-01-04 01:31:44hctsetmessages: + msg207264
2013-11-27 01:24:27benjamin.petersonsetmessages: + msg204546
2013-11-27 01:24:13python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg204545

resolution: fixed
stage: needs patch -> resolved
2013-11-26 20:41:54georg.brandlsetmessages: + msg204533
2013-11-26 11:45:03eric.smithsetnosy: + eric.smith
2013-11-25 22:29:23Arfreversetnosy: + Arfrever
2013-11-25 20:58:03r.david.murraysetnosy: + r.david.murray
2013-11-25 20:57:41r.david.murraysetpriority: normal -> release blocker
nosy: + georg.brandl

type: crash -> behavior
stage: needs patch
2013-11-25 17:42:40hctsetmessages: + msg204373
2013-11-25 17:35:25yselivanovsetnosy: + yselivanov
messages: + msg204370
2013-11-23 02:56:02hayposetmessages: + msg203963
2013-11-23 02:40:27benjamin.petersonsetnosy: + benjamin.peterson
messages: + msg203962
2013-11-23 02:34:43pitrousetnosy: + haypo
2013-11-23 02:18:27hctsettype: crash
2013-11-23 02:18:13hctsettitle: str.format sublevel format parsing broken in Python 3.3.3 -> [regression] str.format sublevel format parsing broken in Python 3.3.3
2013-11-23 02:16:42hctcreate