Mercurial > cpython-lru_cache-weakref
annotate Include/bytes_methods.h @ 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 | 4bdd847b57c2 |
| children |
| rev | line source |
|---|---|
|
43576
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
1 #ifndef Py_BYTES_CTYPE_H |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
2 #define Py_BYTES_CTYPE_H |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
3 |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
4 /* |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
5 * The internal implementation behind PyString (bytes) and PyBytes (buffer) |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
6 * methods of the given names, they operate on ASCII byte strings. |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
7 */ |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
8 extern PyObject* _Py_bytes_isspace(const char *cptr, Py_ssize_t len); |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
9 extern PyObject* _Py_bytes_isalpha(const char *cptr, Py_ssize_t len); |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
10 extern PyObject* _Py_bytes_isalnum(const char *cptr, Py_ssize_t len); |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
11 extern PyObject* _Py_bytes_isdigit(const char *cptr, Py_ssize_t len); |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
12 extern PyObject* _Py_bytes_islower(const char *cptr, Py_ssize_t len); |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
13 extern PyObject* _Py_bytes_isupper(const char *cptr, Py_ssize_t len); |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
14 extern PyObject* _Py_bytes_istitle(const char *cptr, Py_ssize_t len); |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
15 |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
16 /* These store their len sized answer in the given preallocated *result arg. */ |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
17 extern void _Py_bytes_lower(char *result, const char *cptr, Py_ssize_t len); |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
18 extern void _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len); |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
19 extern void _Py_bytes_title(char *result, char *s, Py_ssize_t len); |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
20 extern void _Py_bytes_capitalize(char *result, char *s, Py_ssize_t len); |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
21 extern void _Py_bytes_swapcase(char *result, char *s, Py_ssize_t len); |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
22 |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
23 /* Shared __doc__ strings. */ |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
24 extern const char _Py_isspace__doc__[]; |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
25 extern const char _Py_isalpha__doc__[]; |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
26 extern const char _Py_isalnum__doc__[]; |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
27 extern const char _Py_isdigit__doc__[]; |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
28 extern const char _Py_islower__doc__[]; |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
29 extern const char _Py_isupper__doc__[]; |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
30 extern const char _Py_istitle__doc__[]; |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
31 extern const char _Py_lower__doc__[]; |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
32 extern const char _Py_upper__doc__[]; |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
33 extern const char _Py_title__doc__[]; |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
34 extern const char _Py_capitalize__doc__[]; |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
35 extern const char _Py_swapcase__doc__[]; |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
36 |
|
53539
4bdd847b57c2
Issue #5793: rationalize isdigit / isalpha / tolower, etc. Will port to py3k. Should fix Windows buildbot errors.
Eric Smith <eric@trueblade.com>
parents:
46161
diff
changeset
|
37 /* These are left in for backward compatibility and will be removed |
|
4bdd847b57c2
Issue #5793: rationalize isdigit / isalpha / tolower, etc. Will port to py3k. Should fix Windows buildbot errors.
Eric Smith <eric@trueblade.com>
parents:
46161
diff
changeset
|
38 in 2.8/3.2 */ |
|
4bdd847b57c2
Issue #5793: rationalize isdigit / isalpha / tolower, etc. Will port to py3k. Should fix Windows buildbot errors.
Eric Smith <eric@trueblade.com>
parents:
46161
diff
changeset
|
39 #define ISLOWER(c) Py_ISLOWER(c) |
|
4bdd847b57c2
Issue #5793: rationalize isdigit / isalpha / tolower, etc. Will port to py3k. Should fix Windows buildbot errors.
Eric Smith <eric@trueblade.com>
parents:
46161
diff
changeset
|
40 #define ISUPPER(c) Py_ISUPPER(c) |
|
4bdd847b57c2
Issue #5793: rationalize isdigit / isalpha / tolower, etc. Will port to py3k. Should fix Windows buildbot errors.
Eric Smith <eric@trueblade.com>
parents:
46161
diff
changeset
|
41 #define ISALPHA(c) Py_ISALPHA(c) |
|
4bdd847b57c2
Issue #5793: rationalize isdigit / isalpha / tolower, etc. Will port to py3k. Should fix Windows buildbot errors.
Eric Smith <eric@trueblade.com>
parents:
46161
diff
changeset
|
42 #define ISDIGIT(c) Py_ISDIGIT(c) |
|
4bdd847b57c2
Issue #5793: rationalize isdigit / isalpha / tolower, etc. Will port to py3k. Should fix Windows buildbot errors.
Eric Smith <eric@trueblade.com>
parents:
46161
diff
changeset
|
43 #define ISXDIGIT(c) Py_ISXDIGIT(c) |
|
4bdd847b57c2
Issue #5793: rationalize isdigit / isalpha / tolower, etc. Will port to py3k. Should fix Windows buildbot errors.
Eric Smith <eric@trueblade.com>
parents:
46161
diff
changeset
|
44 #define ISALNUM(c) Py_ISALNUM(c) |
|
4bdd847b57c2
Issue #5793: rationalize isdigit / isalpha / tolower, etc. Will port to py3k. Should fix Windows buildbot errors.
Eric Smith <eric@trueblade.com>
parents:
46161
diff
changeset
|
45 #define ISSPACE(c) Py_ISSPACE(c) |
|
43576
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
46 |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
47 #undef islower |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
48 #define islower(c) undefined_islower(c) |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
49 #undef isupper |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
50 #define isupper(c) undefined_isupper(c) |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
51 #undef isalpha |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
52 #define isalpha(c) undefined_isalpha(c) |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
53 #undef isdigit |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
54 #define isdigit(c) undefined_isdigit(c) |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
55 #undef isxdigit |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
56 #define isxdigit(c) undefined_isxdigit(c) |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
57 #undef isalnum |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
58 #define isalnum(c) undefined_isalnum(c) |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
59 #undef isspace |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
60 #define isspace(c) undefined_isspace(c) |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
61 |
|
53539
4bdd847b57c2
Issue #5793: rationalize isdigit / isalpha / tolower, etc. Will port to py3k. Should fix Windows buildbot errors.
Eric Smith <eric@trueblade.com>
parents:
46161
diff
changeset
|
62 /* These are left in for backward compatibility and will be removed |
|
4bdd847b57c2
Issue #5793: rationalize isdigit / isalpha / tolower, etc. Will port to py3k. Should fix Windows buildbot errors.
Eric Smith <eric@trueblade.com>
parents:
46161
diff
changeset
|
63 in 2.8/3.2 */ |
|
4bdd847b57c2
Issue #5793: rationalize isdigit / isalpha / tolower, etc. Will port to py3k. Should fix Windows buildbot errors.
Eric Smith <eric@trueblade.com>
parents:
46161
diff
changeset
|
64 #define TOLOWER(c) Py_TOLOWER(c) |
|
4bdd847b57c2
Issue #5793: rationalize isdigit / isalpha / tolower, etc. Will port to py3k. Should fix Windows buildbot errors.
Eric Smith <eric@trueblade.com>
parents:
46161
diff
changeset
|
65 #define TOUPPER(c) Py_TOUPPER(c) |
|
43576
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
66 |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
67 #undef tolower |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
68 #define tolower(c) undefined_tolower(c) |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
69 #undef toupper |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
70 #define toupper(c) undefined_toupper(c) |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
71 |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
72 /* this is needed because some docs are shared from the .o, not static */ |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
73 #define PyDoc_STRVAR_shared(name,str) const char name[] = PyDoc_STR(str) |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
74 |
|
697cc31a83f6
For PEP3137: Adds missing methods to the mutable PyBytes object (soon
Gregory P. Smith <greg@mad-scientist.com>
parents:
diff
changeset
|
75 #endif /* !Py_BYTES_CTYPE_H */ |
