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.
Created on 2016年09月14日 11:12 by serhiy.storchaka, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 24213 | merged | iritkatriel, 2021年01月13日 19:40 | |
| PR 26110 | closed | miss-islington, 2021年05月13日 20:57 | |
| PR 26111 | merged | miss-islington, 2021年05月13日 20:57 | |
| PR 26112 | merged | miss-islington, 2021年05月13日 20:57 | |
| Messages (7) | |||
|---|---|---|---|
| msg276415 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2016年09月14日 11:12 | |
For example:
>>> '{:04}'.format('abc')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: '=' alignment not allowed in string format specifier
There is no any '=' in the format string.
>>> '{: }'.format('abc')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Sign not allowed in string format specifier
There is no any sign ('+' or '-') in the format string.
There also an inconsistency between the wording of "something not allowed in string format specifier" and:
>>> '{:x}'.format('abc')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Unknown format code 'x' for object of type 'str'
>>> '{:xx}'.format('abc')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Invalid format specifier
|
|||
| msg276417 - (view) | Author: Eric V. Smith (eric.smith) * (Python committer) | Date: 2016年09月14日 11:32 | |
See also issue 27772. The difference in the error messages is due to the first ones looking for specific invalid combinations (in this case things the string formatter does not understand), and the last one which is "I have no idea what you're asking for". |
|||
| msg385052 - (view) | Author: Irit Katriel (iritkatriel) * (Python committer) | Date: 2021年01月13日 19:42 | |
My PR fixes the second case ('{: }') and Serhiy's PR on Issue27772 fixes the first case ('{:04}').
|
|||
| msg393608 - (view) | Author: miss-islington (miss-islington) | Date: 2021年05月13日 21:25 | |
New changeset 2d780237d95cd3d95401f52be2edeac8b458eb68 by Miss Islington (bot) in branch '3.10': bpo-28146: Fix a confusing error message in str.format() (GH-24213) https://github.com/python/cpython/commit/2d780237d95cd3d95401f52be2edeac8b458eb68 |
|||
| msg393610 - (view) | Author: miss-islington (miss-islington) | Date: 2021年05月13日 21:35 | |
New changeset 133013e8a1ecd570266de766e2df9745a24343be by Miss Islington (bot) in branch '3.9': bpo-28146: Fix a confusing error message in str.format() (GH-24213) https://github.com/python/cpython/commit/133013e8a1ecd570266de766e2df9745a24343be |
|||
| msg393612 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2021年05月13日 21:39 | |
It seems like this issue is entirely fixed now, closing. |
|||
| msg393631 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2021年05月14日 08:08 | |
commit 4aeee0b47b3a2b604bbac37040320ffc88c291f2 Author: Irit Katriel <iritkatriel@yahoo.com> Date: Thu May 13 21:55:55 2021 +0100 bpo-28146: Fix a confusing error message in str.format() (GH-24213) Automerge-Triggered-By: GH:pitrou |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:36 | admin | set | github: 72333 |
| 2021年05月14日 08:08:15 | vstinner | set | messages: + msg393631 |
| 2021年05月13日 21:39:16 | pitrou | set | status: open -> closed versions: + Python 3.9, Python 3.10 nosy: + pitrou messages: + msg393612 resolution: fixed stage: patch review -> resolved |
| 2021年05月13日 21:35:40 | miss-islington | set | messages: + msg393610 |
| 2021年05月13日 21:25:08 | miss-islington | set | messages: + msg393608 |
| 2021年05月13日 20:57:19 | miss-islington | set | pull_requests: + pull_request24756 |
| 2021年05月13日 20:57:14 | miss-islington | set | pull_requests: + pull_request24755 |
| 2021年05月13日 20:57:08 | miss-islington | set | nosy:
+ miss-islington pull_requests: + pull_request24754 |
| 2021年05月13日 20:36:26 | pitrou | set | versions: + Python 3.11 |
| 2021年01月13日 19:42:01 | iritkatriel | set | messages: + msg385052 |
| 2021年01月13日 19:40:50 | iritkatriel | set | keywords:
+ patch nosy: + iritkatriel pull_requests: + pull_request23040 stage: patch review |
| 2016年09月14日 11:32:11 | eric.smith | set | type: behavior messages: + msg276417 nosy: + eric.smith |
| 2016年09月14日 11:12:52 | serhiy.storchaka | set | title: Confusing error examples in str.format() -> Confusing error messages in str.format() |
| 2016年09月14日 11:12:35 | serhiy.storchaka | create | |