Skip to content

Commit befd574

Browse files
committed
Move _PyBytesWriter_CreateByteArray() to the internal C API
1 parent 7095ac4 commit befd574

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

Include/cpython/bytesobject.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ typedef struct PyBytesWriter PyBytesWriter;
4848

4949
PyAPI_FUNC(PyBytesWriter *) PyBytesWriter_Create(
5050
Py_ssize_t size);
51-
PyAPI_FUNC(PyBytesWriter*) _PyBytesWriter_CreateByteArray(
52-
Py_ssize_t size);
5351
PyAPI_FUNC(void) PyBytesWriter_Discard(
5452
PyBytesWriter *writer);
5553
PyAPI_FUNC(PyObject*) PyBytesWriter_Finish(

Include/internal/pycore_bytesobject.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ PyAPI_FUNC(void*) _PyBytesWriter_WriteBytes(_PyBytesWriter *writer,
142142
const void *bytes,
143143
Py_ssize_t size);
144144

145+
// Export for '_testcapi' shared extension.
146+
PyAPI_FUNC(PyBytesWriter*) _PyBytesWriter_CreateByteArray(
147+
Py_ssize_t size);
148+
145149
#ifdef __cplusplus
146150
}
147151
#endif

Modules/_testcapi/bytes.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
// Use pycore_bytes.h
2+
#define PYTESTCAPI_NEED_INTERNAL_API
3+
14
#include "parts.h"
25
#include "util.h"
36

7+
#include "pycore_bytesobject.h" // _PyBytesWriter_CreateByteArray()
8+
49

510
/* Test _PyBytes_Resize() */
611
static PyObject *

0 commit comments

Comments
 (0)