[issue27772] Refer to actual format string when creating “zero padding” error message

2021-01-25 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10 -Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27772] Refer to actual format string when creating “zero padding” error message

2021-01-25 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset cf19cc3b920ca5995e1c202d2c3dd7a59ac8eac8 by Serhiy Storchaka in 
branch 'master':
bpo-27772: Make preceding width with 0 valid in string format. (GH-11270)
https://github.com/python/cpython/commit/cf19cc3b920ca5995e1c202d2c3dd7a59ac8eac8


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27772] Refer to actual format string when creating “zero padding” error message

2018-12-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
components: +Interpreter Core
versions: +Python 3.8 -Python 2.7, Python 3.5, Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27772] Refer to actual format string when creating “zero padding” error message

2018-12-20 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

PR 11270 fixes this issue by making such format valid. Preceding the width 
field by '0' no longer affects the default alignment for strings, i.e. no 
longer sets the alignment to invalid '=' if it is not specified explicitly.

>>> format('abc', '<8')
'abc '
>>> format('abc', '8')
'abc '
>>> format('abc', '<08')
'abc0'
>>> format('abc', '08')
'abc0'

This does not contradict the documentation, which specifies this case for 
numeric types, but not for strings.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27772] Refer to actual format string when creating “zero padding” error message

2018-12-20 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +10506
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27772] Refer to actual format string when creating “zero padding” error message

2016-08-15 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +eric.smith
versions: +Python 3.6 -Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27772] Refer to actual format string when creating “zero padding” error message

2016-08-15 Thread Ben Finney

New submission from Ben Finney:

When using a format specifier with leading zero, the format spec mini-language 
(as documented at 
https://docs.python.org/3/library/string.html#format-specification-mini-language>)
 says:

> '=' […] becomes the default when ‘0’ immediately precedes the field width.

When the ‘=’ option is only implied, the error message “ValueError: '=' 
alignment not allowed in string format specifier” becomes surprising and 
incomprehensible to someone who does not know that implied behaviour.

In issue 15560, Terry Reedy says:

> If the spec string is still available, it could be searched and the message 
> adjusted if '=' is not present.  That proposal should be a new issue if 
> someone wants to push it.

This issue raises that proposal.

The error message should be changed so that:

* It makes sense whether or not the ‘=’ option is explicit in the format 
specifier.

Or:

* Different messages are produced when the ‘=’ option is explicit versus when 
it is implicit.

I think the former option is better, but either will satisfy this request.

--
messages: 272827
nosy: bignose
priority: normal
severity: normal
status: open
title: Refer to actual format string when creating “zero padding” error message
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com