Issue 14723: Misleading error message for str.format() (original) (raw)

Issue14723

Created on 2012-05-04 18:21 by theisenm, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg159955 - (view) Author: Mark Theisen (theisenm) Date: 2012-05-04 18:21
When I run this code: '{0:i}'.format(None) I get this error: ValueError: Unknown format code 'i' for object of type 'str' This seems misleading because None is of Type 'NoneType'. I was expecting the error to say something to the effect of: Unknown format code 'i' for object of type 'NoneType'
msg159957 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2012-05-04 18:25
This is a duplicate of issue 13790. See the comments there for why it works this way.
History
Date User Action Args
2022-04-11 14:57:29 admin set github: 58928
2012-05-04 18:25:14 eric.smith set status: open -> closednosy: + eric.smithmessages: + superseder: In str.format an incorrect error message for list, tuple, dict, setresolution: duplicate
2012-05-04 18:21:12 theisenm create