Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(164403)

Delta Between Two Patch Sets: Include/bytesobject.h

Issue 28128: Improve the warning message for invalid escape sequences
Left Patch Set: Created 3 years, 1 month ago
Right Patch Set: Created 3 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | Include/unicodeobject.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1
1 /* Bytes (String) object interface */ 2 /* Bytes (String) object interface */
2 3
3 #ifndef Py_BYTESOBJECT_H 4 #ifndef Py_BYTESOBJECT_H
4 #define Py_BYTESOBJECT_H 5 #define Py_BYTESOBJECT_H
5 #ifdef __cplusplus 6 #ifdef __cplusplus
6 extern "C" { 7 extern "C" {
7 #endif 8 #endif
8 9
9 #include <stdarg.h> 10 #include <stdarg.h>
10 11
(...skipping 26 matching lines...) Expand all
37 * ob_sval[ob_size] == 0. 38 * ob_sval[ob_size] == 0.
38 * ob_shash is the hash of the string or -1 if not computed yet. 39 * ob_shash is the hash of the string or -1 if not computed yet.
39 */ 40 */
40 } PyBytesObject; 41 } PyBytesObject;
41 #endif 42 #endif
42 43
43 PyAPI_DATA(PyTypeObject) PyBytes_Type; 44 PyAPI_DATA(PyTypeObject) PyBytes_Type;
44 PyAPI_DATA(PyTypeObject) PyBytesIter_Type; 45 PyAPI_DATA(PyTypeObject) PyBytesIter_Type;
45 46
46 #define PyBytes_Check(op) \ 47 #define PyBytes_Check(op) \
47 » » PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_BYTES_SUBCLASS) 48 PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_BYTES_SUBCLASS)
storchaka 2016/10/31 10:52:05 Unrelated change.
48 #define PyBytes_CheckExact(op) (Py_TYPE(op) == &PyBytes_Type) 49 #define PyBytes_CheckExact(op) (Py_TYPE(op) == &PyBytes_Type)
49 50
50 PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t); 51 PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);
51 PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *); 52 PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *);
52 PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *); 53 PyAPI_FUNC(PyObject *) PyBytes_FromObject(PyObject *);
53 PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list) 54 PyAPI_FUNC(PyObject *) PyBytes_FromFormatV(const char*, va_list)
54 Py_GCC_ATTRIBUTE((format(printf, 1, 0))); 55 Py_GCC_ATTRIBUTE((format(printf, 1, 0)));
55 PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...) 56 PyAPI_FUNC(PyObject *) PyBytes_FromFormat(const char*, ...)
56 Py_GCC_ATTRIBUTE((format(printf, 1, 2))); 57 Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
57 PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *); 58 PyAPI_FUNC(Py_ssize_t) PyBytes_Size(PyObject *);
(...skipping 10 matching lines...) Expand all
68 int use_bytearray); 69 int use_bytearray);
69 PyAPI_FUNC(PyObject*) _PyBytes_FromHex( 70 PyAPI_FUNC(PyObject*) _PyBytes_FromHex(
70 PyObject *string, 71 PyObject *string,
71 int use_bytearray); 72 int use_bytearray);
72 #endif 73 #endif
73 PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t, 74 PyAPI_FUNC(PyObject *) PyBytes_DecodeEscape(const char *, Py_ssize_t,
74 const char *, Py_ssize_t, 75 const char *, Py_ssize_t,
75 const char *); 76 const char *);
76 /* Helper for PyBytes_DecodeEscape that detects invalid escape chars. */ 77 /* Helper for PyBytes_DecodeEscape that detects invalid escape chars. */
77 PyAPI_FUNC(PyObject *) _PyBytes_DecodeEscape(const char *, Py_ssize_t, 78 PyAPI_FUNC(PyObject *) _PyBytes_DecodeEscape(const char *, Py_ssize_t,
78 » » » » » » const char *, Py_ssize_t, 79 const char *, Py_ssize_t,
79 » » » » » » const char *, 80 const char *,
80 » » » » » » const char**); 81 const char **);
storchaka 2016/10/31 10:52:05 If there is a space between "char" and "*" in abov
81 82
82 /* Macro, trading safety for speed */ 83 /* Macro, trading safety for speed */
83 #ifndef Py_LIMITED_API 84 #ifndef Py_LIMITED_API
84 #define PyBytes_AS_STRING(op) (assert(PyBytes_Check(op)), \ 85 #define PyBytes_AS_STRING(op) (assert(PyBytes_Check(op)), \
85 » » » » (((PyBytesObject *)(op))->ob_sval)) 86 (((PyBytesObject *)(op))->ob_sval))
86 #define PyBytes_GET_SIZE(op) (assert(PyBytes_Check(op)),Py_SIZE(op)) 87 #define PyBytes_GET_SIZE(op) (assert(PyBytes_Check(op)),Py_SIZE(op))
87 #endif 88 #endif
88 89
89 /* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*, 90 /* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*,
90 x must be an iterable object. */ 91 x must be an iterable object. */
91 #ifndef Py_LIMITED_API 92 #ifndef Py_LIMITED_API
92 PyAPI_FUNC(PyObject *) _PyBytes_Join(PyObject *sep, PyObject *x); 93 PyAPI_FUNC(PyObject *) _PyBytes_Join(PyObject *sep, PyObject *x);
93 #endif 94 #endif
94 95
95 /* Provides access to the internal data buffer and size of a string 96 /* Provides access to the internal data buffer and size of a string
96 object or the default encoded version of a Unicode object. Passing 97 object or the default encoded version of a Unicode object. Passing
97 NULL as *len parameter will force the string buffer to be 98 NULL as *len parameter will force the string buffer to be
98 0-terminated (passing a string with embedded NULL characters will 99 0-terminated (passing a string with embedded NULL characters will
99 cause an exception). */ 100 cause an exception). */
100 PyAPI_FUNC(int) PyBytes_AsStringAndSize( 101 PyAPI_FUNC(int) PyBytes_AsStringAndSize(
101 PyObject *obj, /* string or Unicode object */ 102 PyObject *obj, /* string or Unicode object */
102 char **s, /* pointer to buffer variable */ 103 char **s, /* pointer to buffer variable */
103 Py_ssize_t *len /* pointer to length variable or NULL 104 Py_ssize_t *len /* pointer to length variable or NULL
104 » » » (only possible for 0-terminated 105 (only possible for 0-terminated
105 » » » strings) */ 106 strings) */
106 ); 107 );
107 108
108 /* Using the current locale, insert the thousands grouping 109 /* Using the current locale, insert the thousands grouping
109 into the string pointed to by buffer. For the argument descriptions, 110 into the string pointed to by buffer. For the argument descriptions,
110 see Objects/stringlib/localeutil.h */ 111 see Objects/stringlib/localeutil.h */
111 #ifndef Py_LIMITED_API 112 #ifndef Py_LIMITED_API
112 PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGroupingLocale(char *buffer, 113 PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGroupingLocale(char *buffer,
113 » » » » » » Py_ssize_t n_buffer, 114 Py_ssize_t n_buffer,
114 » » » » » » char *digits, 115 char *digits,
115 » » » » » » Py_ssize_t n_digits, 116 Py_ssize_t n_digits,
116 » » » » » » Py_ssize_t min_width); 117 Py_ssize_t min_width);
117 118
118 /* Using explicit passed-in values, insert the thousands grouping 119 /* Using explicit passed-in values, insert the thousands grouping
119 into the string pointed to by buffer. For the argument descriptions, 120 into the string pointed to by buffer. For the argument descriptions,
120 see Objects/stringlib/localeutil.h */ 121 see Objects/stringlib/localeutil.h */
121 PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGrouping(char *buffer, 122 PyAPI_FUNC(Py_ssize_t) _PyBytes_InsertThousandsGrouping(char *buffer,
122 » » » » » » Py_ssize_t n_buffer, 123 Py_ssize_t n_buffer,
123 » » » » » » char *digits, 124 char *digits,
124 » » » » » » Py_ssize_t n_digits, 125 Py_ssize_t n_digits,
125 » » » » » » Py_ssize_t min_width, 126 Py_ssize_t min_width,
126 » » » » » » const char *grouping, 127 const char *grouping,
127 » » » » » » const char *thousands_sep); 128 const char *thousands_sep);
128 #endif 129 #endif
129 130
130 /* Flags used by string formatting */ 131 /* Flags used by string formatting */
131 #define F_LJUST (1<<0) 132 #define F_LJUST (1<<0)
132 #define F_SIGN (1<<1) 133 #define F_SIGN (1<<1)
133 #define F_BLANK (1<<2) 134 #define F_BLANK (1<<2)
134 #define F_ALT (1<<3) 135 #define F_ALT (1<<3)
135 #define F_ZERO (1<<4) 136 #define F_ZERO (1<<4)
136 137
137 #ifndef Py_LIMITED_API 138 #ifndef Py_LIMITED_API
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 PyAPI_FUNC(void*) _PyBytesWriter_WriteBytes(_PyBytesWriter *writer, 213 PyAPI_FUNC(void*) _PyBytesWriter_WriteBytes(_PyBytesWriter *writer,
213 void *str, 214 void *str,
214 const void *bytes, 215 const void *bytes,
215 Py_ssize_t size); 216 Py_ssize_t size);
216 #endif /* Py_LIMITED_API */ 217 #endif /* Py_LIMITED_API */
217 218
218 #ifdef __cplusplus 219 #ifdef __cplusplus
219 } 220 }
220 #endif 221 #endif
221 #endif /* !Py_BYTESOBJECT_H */ 222 #endif /* !Py_BYTESOBJECT_H */
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+