]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
Modified parsing of format strings, so that we always return
authorEric Smith <eric@trueblade.com>
Wed, 29 Aug 2007 03:22:59 +0000 (03:22 +0000)
committerEric Smith <eric@trueblade.com>
Wed, 29 Aug 2007 03:22:59 +0000 (03:22 +0000)
commit625cbf28eeeed3f2d8afffa6c442f10d58ae6607
treed555d101cd7c3986a0e85cb25eef85b71fe6d10f
parent9600f93db6038ef6d5a1254295bac61e96fa56a2
Modified parsing of format strings, so that we always return
a tuple (literal, field_name, format_spec, conversion).

literal will always be a string, but might be of zero length.
field_name will be None if there is no markup text
format_spec will be a (possibly zero length) string if
  field_name is non-None
conversion will be a one character string, or None

This makes the Formatter class, and especially it's parse()
method, easier to understand.

Suggestion was by Jim Jewett, inspired by the "tail" of an
elementtree node.

Also, fixed a reference leak in fieldnameiter_next.
Lib/string.py
Objects/stringlib/string_format.h