New submission from Sascha Desch <sascha.de...@hotmail.com>:
It appears when adding auto-numbered positional fields in python 3.1 `Formatter.parse` was not updated to handle them and currently returns an empty string as the field name. ``` list(Formatter().parse('hello {}')) # [('hello ', '', '', None)] ``` This does not align with `Formatter.get_field` which according to the docs: "Given field_name as returned by parse() (see above), convert it to an object to be formatted." When supplying an empty string to `.get_field()` you get a KeyError ``` Formatter().get_field("", [1, 2, 3], {}). # raises KeyError ``` ---------- messages: 405610 nosy: SDesch priority: normal severity: normal status: open title: string.Formatter.parse does not handle auto-numbered positional fields type: behavior versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45704> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com