11
2- /* Bytes (String ) object interface */
2+ /* String (Bytes ) object interface */
33
44#ifndef Py_BYTESOBJECT_H
55#define Py_BYTESOBJECT_H
@@ -10,7 +10,7 @@ extern "C" {
1010#include <stdarg.h>
1111
1212/*
13- Type PyBytesObject represents a character string. An extra zero byte is
13+ Type PyStringObject represents a character string. An extra zero byte is
1414reserved at the end to ensure it is zero-terminated, but a size is
1515present so strings with null bytes in them can be represented. This
1616is an immutable object type.
@@ -46,61 +46,61 @@ typedef struct {
4646 * 'interned' dictionary; in this case the two references
4747 * from 'interned' to this object are *not counted* in ob_refcnt.
4848 */
49- } PyBytesObject ;
49+ } PyStringObject ;
5050
5151#define SSTATE_NOT_INTERNED 0
5252#define SSTATE_INTERNED_MORTAL 1
5353#define SSTATE_INTERNED_IMMORTAL 2
5454
5555PyAPI_DATA (PyTypeObject ) PyBaseString_Type ;
56- PyAPI_DATA (PyTypeObject ) PyBytes_Type ;
56+ PyAPI_DATA (PyTypeObject ) PyString_Type ;
5757
58- #define PyBytes_Check (op ) \
58+ #define PyString_Check (op ) \
5959 PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_STRING_SUBCLASS)
60- #define PyBytes_CheckExact (op ) (Py_TYPE(op) == &PyBytes_Type )
60+ #define PyString_CheckExact (op ) (Py_TYPE(op) == &PyString_Type )
6161
62- PyAPI_FUNC (PyObject * ) PyBytes_FromStringAndSize (const char * , Py_ssize_t );
63- PyAPI_FUNC (PyObject * ) PyBytes_FromString (const char * );
64- PyAPI_FUNC (PyObject * ) PyBytes_FromFormatV (const char * , va_list )
62+ PyAPI_FUNC (PyObject * ) PyString_FromStringAndSize (const char * , Py_ssize_t );
63+ PyAPI_FUNC (PyObject * ) PyString_FromString (const char * );
64+ PyAPI_FUNC (PyObject * ) PyString_FromFormatV (const char * , va_list )
6565 Py_GCC_ATTRIBUTE ((format (printf , 1 , 0 )));
66- PyAPI_FUNC (PyObject * ) PyBytes_FromFormat (const char * , ...)
66+ PyAPI_FUNC (PyObject * ) PyString_FromFormat (const char * , ...)
6767 Py_GCC_ATTRIBUTE ((format (printf , 1 , 2 )));
68- PyAPI_FUNC (Py_ssize_t ) PyBytes_Size (PyObject * );
69- PyAPI_FUNC (char * ) PyBytes_AsString (PyObject * );
70- PyAPI_FUNC (PyObject * ) PyBytes_Repr (PyObject * , int );
71- PyAPI_FUNC (void ) PyBytes_Concat (PyObject * * , PyObject * );
72- PyAPI_FUNC (void ) PyBytes_ConcatAndDel (PyObject * * , PyObject * );
73- PyAPI_FUNC (int ) _PyBytes_Resize (PyObject * * , Py_ssize_t );
74- PyAPI_FUNC (int ) _PyBytes_Eq (PyObject * , PyObject * );
75- PyAPI_FUNC (PyObject * ) PyBytes_Format (PyObject * , PyObject * );
76- PyAPI_FUNC (PyObject * ) _PyBytes_FormatLong (PyObject * , int , int ,
68+ PyAPI_FUNC (Py_ssize_t ) PyString_Size (PyObject * );
69+ PyAPI_FUNC (char * ) PyString_AsString (PyObject * );
70+ PyAPI_FUNC (PyObject * ) PyString_Repr (PyObject * , int );
71+ PyAPI_FUNC (void ) PyString_Concat (PyObject * * , PyObject * );
72+ PyAPI_FUNC (void ) PyString_ConcatAndDel (PyObject * * , PyObject * );
73+ PyAPI_FUNC (int ) _PyString_Resize (PyObject * * , Py_ssize_t );
74+ PyAPI_FUNC (int ) _PyString_Eq (PyObject * , PyObject * );
75+ PyAPI_FUNC (PyObject * ) PyString_Format (PyObject * , PyObject * );
76+ PyAPI_FUNC (PyObject * ) _PyString_FormatLong (PyObject * , int , int ,
7777 int , char * * , int * );
78- PyAPI_FUNC (PyObject * ) PyBytes_DecodeEscape (const char * , Py_ssize_t ,
78+ PyAPI_FUNC (PyObject * ) PyString_DecodeEscape (const char * , Py_ssize_t ,
7979 const char * , Py_ssize_t ,
8080 const char * );
8181
82- PyAPI_FUNC (void ) PyBytes_InternInPlace (PyObject * * );
83- PyAPI_FUNC (void ) PyBytes_InternImmortal (PyObject * * );
84- PyAPI_FUNC (PyObject * ) PyBytes_InternFromString (const char * );
82+ PyAPI_FUNC (void ) PyString_InternInPlace (PyObject * * );
83+ PyAPI_FUNC (void ) PyString_InternImmortal (PyObject * * );
84+ PyAPI_FUNC (PyObject * ) PyString_InternFromString (const char * );
8585PyAPI_FUNC (void ) _Py_ReleaseInternedStrings (void );
8686
8787/* Use only if you know it's a string */
88- #define PyBytes_CHECK_INTERNED (op ) (((PyBytesObject *)(op))->ob_sstate)
88+ #define PyString_CHECK_INTERNED (op ) (((PyStringObject *)(op))->ob_sstate)
8989
9090/* Macro, trading safety for speed */
91- #define PyBytes_AS_STRING (op ) (((PyBytesObject *)(op))->ob_sval)
92- #define PyBytes_GET_SIZE (op ) Py_SIZE(op)
91+ #define PyString_AS_STRING (op ) (((PyStringObject *)(op))->ob_sval)
92+ #define PyString_GET_SIZE (op ) Py_SIZE(op)
9393
94- /* _PyBytes_Join (sep, x) is like sep.join(x). sep must be PyBytesObject *,
94+ /* _PyString_Join (sep, x) is like sep.join(x). sep must be PyStringObject *,
9595 x must be an iterable object. */
96- PyAPI_FUNC (PyObject * ) _PyBytes_Join (PyObject * sep , PyObject * x );
96+ PyAPI_FUNC (PyObject * ) _PyString_Join (PyObject * sep , PyObject * x );
9797
9898/* --- Generic Codecs ----------------------------------------------------- */
9999
100100/* Create an object by decoding the encoded string s of the
101101 given size. */
102102
103- PyAPI_FUNC (PyObject * ) PyBytes_Decode (
103+ PyAPI_FUNC (PyObject * ) PyString_Decode (
104104 const char * s , /* encoded string */
105105 Py_ssize_t size , /* size of buffer */
106106 const char * encoding , /* encoding */
@@ -110,7 +110,7 @@ PyAPI_FUNC(PyObject*) PyBytes_Decode(
110110/* Encodes a char buffer of the given size and returns a
111111 Python object. */
112112
113- PyAPI_FUNC (PyObject * ) PyBytes_Encode (
113+ PyAPI_FUNC (PyObject * ) PyString_Encode (
114114 const char * s , /* string char buffer */
115115 Py_ssize_t size , /* number of chars to encode */
116116 const char * encoding , /* encoding */
@@ -120,7 +120,7 @@ PyAPI_FUNC(PyObject*) PyBytes_Encode(
120120/* Encodes a string object and returns the result as Python
121121 object. */
122122
123- PyAPI_FUNC (PyObject * ) PyBytes_AsEncodedObject (
123+ PyAPI_FUNC (PyObject * ) PyString_AsEncodedObject (
124124 PyObject * str , /* string object */
125125 const char * encoding , /* encoding */
126126 const char * errors /* error handling */
@@ -132,9 +132,9 @@ PyAPI_FUNC(PyObject*) PyBytes_AsEncodedObject(
132132 If the codec returns an Unicode object, the object is converted
133133 back to a string using the default encoding.
134134
135- DEPRECATED - use PyBytes_AsEncodedObject () instead. */
135+ DEPRECATED - use PyString_AsEncodedObject () instead. */
136136
137- PyAPI_FUNC (PyObject * ) PyBytes_AsEncodedString (
137+ PyAPI_FUNC (PyObject * ) PyString_AsEncodedString (
138138 PyObject * str , /* string object */
139139 const char * encoding , /* encoding */
140140 const char * errors /* error handling */
@@ -143,7 +143,7 @@ PyAPI_FUNC(PyObject*) PyBytes_AsEncodedString(
143143/* Decodes a string object and returns the result as Python
144144 object. */
145145
146- PyAPI_FUNC (PyObject * ) PyBytes_AsDecodedObject (
146+ PyAPI_FUNC (PyObject * ) PyString_AsDecodedObject (
147147 PyObject * str , /* string object */
148148 const char * encoding , /* encoding */
149149 const char * errors /* error handling */
@@ -155,9 +155,9 @@ PyAPI_FUNC(PyObject*) PyBytes_AsDecodedObject(
155155 If the codec returns an Unicode object, the object is converted
156156 back to a string using the default encoding.
157157
158- DEPRECATED - use PyBytes_AsDecodedObject () instead. */
158+ DEPRECATED - use PyString_AsDecodedObject () instead. */
159159
160- PyAPI_FUNC (PyObject * ) PyBytes_AsDecodedString (
160+ PyAPI_FUNC (PyObject * ) PyString_AsDecodedString (
161161 PyObject * str , /* string object */
162162 const char * encoding , /* encoding */
163163 const char * errors /* error handling */
@@ -169,7 +169,7 @@ PyAPI_FUNC(PyObject*) PyBytes_AsDecodedString(
169169 0-terminated (passing a string with embedded NULL characters will
170170 cause an exception). */
171171
172- PyAPI_FUNC (int ) PyBytes_AsStringAndSize (
172+ PyAPI_FUNC (int ) PyString_AsStringAndSize (
173173 register PyObject * obj , /* string or Unicode object */
174174 register char * * s , /* pointer to buffer variable */
175175 register Py_ssize_t * len /* pointer to length variable or NULL
@@ -181,7 +181,7 @@ PyAPI_FUNC(int) PyBytes_AsStringAndSize(
181181 into the string pointed to by buffer. For the argument descriptions,
182182 see Objects/stringlib/localeutil.h */
183183
184- PyAPI_FUNC (int ) _PyBytes_InsertThousandsGrouping (char * buffer ,
184+ PyAPI_FUNC (int ) _PyString_InsertThousandsGrouping (char * buffer ,
185185 Py_ssize_t len ,
186186 char * plast ,
187187 Py_ssize_t buf_size ,
0 commit comments