Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a2074f0

Browse files
committed
Kill PyString_Encode(), which isn't used anywhere.
(We should also kill the other PyString_ encode/decode APIs, but they still have some users.)
1 parent 35d02c1 commit a2074f0

2 files changed

Lines changed: 8 additions & 27 deletions

File tree

Doc/c-api/concrete.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -874,15 +874,6 @@ called with a non-string parameter.
874874
if an exception was raised by the codec.
875875

876876

877-
.. cfunction:: PyObject* PyString_Encode(const char *s, Py_ssize_t size, const char *encoding, const char *errors)
878-
879-
Encode the :ctype:`char` buffer of the given size by passing it to the codec
880-
registered for *encoding* and return a Python object. *encoding* and *errors*
881-
have the same meaning as the parameters of the same name in the string
882-
:meth:`encode` method. The codec to be used is looked up using the Python codec
883-
registry. Return *NULL* if an exception was raised by the codec.
884-
885-
886877
.. cfunction:: PyObject* PyString_AsEncodedObject(PyObject *str, const char *encoding, const char *errors)
887878

888879
Encode a string object using the codec registered for *encoding* and return the

Include/stringobject.h

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ PyAPI_FUNC(int) _PyString_Eq(PyObject *, PyObject*);
7070
PyAPI_FUNC(PyObject *) PyString_Format(PyObject *, PyObject *);
7171
PyAPI_FUNC(PyObject *) _PyString_FormatLong(PyObject*, int, int,
7272
int, char**, int*);
73-
PyAPI_FUNC(PyObject *) PyString_DecodeEscape(const char *, Py_ssize_t,
73+
PyAPI_FUNC(PyObject *) PyString_DecodeEscape(const char *, Py_ssize_t,
7474
const char *, Py_ssize_t,
7575
const char *);
7676

@@ -102,17 +102,7 @@ PyAPI_FUNC(PyObject*) PyString_Decode(
102102
const char *errors /* error handling */
103103
);
104104

105-
/* Encodes a char buffer of the given size and returns a
106-
Python object. */
107-
108-
PyAPI_FUNC(PyObject*) PyString_Encode(
109-
const char *s, /* string char buffer */
110-
Py_ssize_t size, /* number of chars to encode */
111-
const char *encoding, /* encoding */
112-
const char *errors /* error handling */
113-
);
114-
115-
/* Encodes a string object and returns the result as Python
105+
/* Encodes a string object and returns the result as Python
116106
object. */
117107

118108
PyAPI_FUNC(PyObject*) PyString_AsEncodedObject(
@@ -122,8 +112,8 @@ PyAPI_FUNC(PyObject*) PyString_AsEncodedObject(
122112
);
123113

124114
/* Encodes a string object and returns the result as Python string
125-
object.
126-
115+
object.
116+
127117
If the codec returns an Unicode object, the object is converted
128118
back to a string using the default encoding.
129119
@@ -135,7 +125,7 @@ PyAPI_FUNC(PyObject*) PyString_AsEncodedString(
135125
const char *errors /* error handling */
136126
);
137127

138-
/* Decodes a string object and returns the result as Python
128+
/* Decodes a string object and returns the result as Python
139129
object. */
140130

141131
PyAPI_FUNC(PyObject*) PyString_AsDecodedObject(
@@ -145,8 +135,8 @@ PyAPI_FUNC(PyObject*) PyString_AsDecodedObject(
145135
);
146136

147137
/* Decodes a string object and returns the result as Python string
148-
object.
149-
138+
object.
139+
150140
If the codec returns an Unicode object, the object is converted
151141
back to a string using the default encoding.
152142
@@ -171,7 +161,7 @@ PyAPI_FUNC(int) PyString_AsStringAndSize(
171161
(only possible for 0-terminated
172162
strings) */
173163
);
174-
164+
175165

176166
#ifdef __cplusplus
177167
}

0 commit comments

Comments
 (0)