annotate Python/formatter_unicode.c @ 58973:db86bf39ccaa legacy-trunk

Issue 7970: When email.Parser.Parser parses a MIME message of type message/rfc822 it turns it into an object whose body consists of a list containing a single Message object. HeaderParser, on the other hand, just copies the body as a string. Generator.flatten has a special handler for the message mime type that expected the body to be the one item list. This fails if the message was parsed by HeaderParser. So we now check to see if the body is a string first, and if so just we just emit it.
author R. David Murray <rdmurray@bitdance.com>
date Sun, 21 Feb 2010 04:23:00 +0000
parents 34e7c1b14495
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
45381
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
1 /* Implements the unicode (as opposed to string) version of the
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
2 built-in formatter for unicode. That is, unicode.__format__(). */
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
3
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
4 #include "Python.h"
51032
551257c8058a fix building the core with --disable-unicode
Benjamin Peterson <benjamin@python.org>
parents: 47392
diff changeset
5
551257c8058a fix building the core with --disable-unicode
Benjamin Peterson <benjamin@python.org>
parents: 47392
diff changeset
6 #ifdef Py_USING_UNICODE
551257c8058a fix building the core with --disable-unicode
Benjamin Peterson <benjamin@python.org>
parents: 47392
diff changeset
7
45381
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
8 #include "../Objects/stringlib/unicodedefs.h"
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
9
47392
47ef9a806ce9 Refactor and clean up str.format() code (and helpers) in advance of optimizations.
Eric Smith <eric@trueblade.com>
parents: 45381
diff changeset
10 #define FORMAT_STRING _PyUnicode_FormatAdvanced
47ef9a806ce9 Refactor and clean up str.format() code (and helpers) in advance of optimizations.
Eric Smith <eric@trueblade.com>
parents: 45381
diff changeset
11
53629
34e7c1b14495 Issue #1588: Add complex.__format__.
Eric Smith <eric@trueblade.com>
parents: 51032
diff changeset
12 /* don't define FORMAT_LONG, FORMAT_FLOAT, and FORMAT_COMPLEX, since
34e7c1b14495 Issue #1588: Add complex.__format__.
Eric Smith <eric@trueblade.com>
parents: 51032
diff changeset
13 we can live with only the string versions of those. The builtin
34e7c1b14495 Issue #1588: Add complex.__format__.
Eric Smith <eric@trueblade.com>
parents: 51032
diff changeset
14 format() will convert them to unicode. */
47392
47ef9a806ce9 Refactor and clean up str.format() code (and helpers) in advance of optimizations.
Eric Smith <eric@trueblade.com>
parents: 45381
diff changeset
15
45381
b7231bf6bfb7 Backport of PEP 3101, Advanced String Formatting, from py3k.
Eric Smith <eric@trueblade.com>
parents:
diff changeset
16 #include "../Objects/stringlib/formatter.h"
51032
551257c8058a fix building the core with --disable-unicode
Benjamin Peterson <benjamin@python.org>
parents: 47392
diff changeset
17
551257c8058a fix building the core with --disable-unicode
Benjamin Peterson <benjamin@python.org>
parents: 47392
diff changeset
18 #endif