Skip to content

Commit 99204fd

Browse files
Add stub functions.
1 parent 0afcdf1 commit 99204fd

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

Include/internal/pycore_bytesobject.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ extern PyObject* _PyBytes_FromHex(
2323
PyAPI_FUNC(PyObject*) _PyBytes_DecodeEscape2(const char *, Py_ssize_t,
2424
const char *,
2525
int *, const char **);
26+
// Export for binary compatibility.
27+
PyAPI_FUNC(PyObject*) _PyBytes_DecodeEscape(const char *, Py_ssize_t,
28+
const char *, const char **);
2629

2730

2831
// Substring Search.

Include/internal/pycore_unicodeobject.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,15 @@ PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscapeInternal2(
154154
point to the first invalid escaped
155155
char in string.
156156
May be NULL if errors is not NULL. */
157+
// Export for binary compatibility.
158+
PyAPI_FUNC(PyObject*) _PyUnicode_DecodeUnicodeEscapeInternal(
159+
const char *string, /* Unicode-Escape encoded string */
160+
Py_ssize_t length, /* size of string */
161+
const char *errors, /* error handling */
162+
Py_ssize_t *consumed, /* bytes consumed */
163+
const char **first_invalid_escape); /* on return, points to first
164+
invalid escaped char in
165+
string. */
157166

158167
/* --- Raw-Unicode-Escape Codecs ---------------------------------------------- */
159168

Objects/bytesobject.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,6 +1183,19 @@ PyObject *_PyBytes_DecodeEscape2(const char *s,
11831183
return NULL;
11841184
}
11851185

1186+
// Export for binary compatibility.
1187+
PyObject *_PyBytes_DecodeEscape(const char *s,
1188+
Py_ssize_t len,
1189+
const char *errors,
1190+
const char **first_invalid_escape)
1191+
{
1192+
int first_invalid_escape_char;
1193+
return _PyBytes_DecodeEscape2(
1194+
s, len, errors,
1195+
&first_invalid_escape_char,
1196+
first_invalid_escape);
1197+
}
1198+
11861199
PyObject *PyBytes_DecodeEscape(const char *s,
11871200
Py_ssize_t len,
11881201
const char *errors,

Objects/unicodeobject.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6433,6 +6433,21 @@ _PyUnicode_DecodeUnicodeEscapeInternal2(const char *s,
64336433
return NULL;
64346434
}
64356435

6436+
// Export for binary compatibility.
6437+
PyObject *
6438+
_PyUnicode_DecodeUnicodeEscapeInternal(const char *s,
6439+
Py_ssize_t size,
6440+
const char *errors,
6441+
Py_ssize_t *consumed,
6442+
const char **first_invalid_escape)
6443+
{
6444+
int first_invalid_escape_char;
6445+
return _PyUnicode_DecodeUnicodeEscapeInternal2(
6446+
s, size, errors, consumed,
6447+
&first_invalid_escape_char,
6448+
first_invalid_escape);
6449+
}
6450+
64366451
PyObject *
64376452
_PyUnicode_DecodeUnicodeEscapeStateful(const char *s,
64386453
Py_ssize_t size,

0 commit comments

Comments
 (0)