mirror of
https://github.com/AdaCore/cpython.git
synced 2026-02-12 12:57:15 -08:00
Delete bufferobject.[ch].
This will undoubtedly require Windows build file changes too.
This commit is contained in:
@@ -76,7 +76,6 @@
|
||||
#endif
|
||||
#include "rangeobject.h"
|
||||
#include "stringobject.h"
|
||||
#include "bufferobject.h"
|
||||
#include "memoryobject.h"
|
||||
#include "tupleobject.h"
|
||||
#include "listobject.h"
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
|
||||
/* Buffer object interface */
|
||||
|
||||
/* Note: the object's structure is private */
|
||||
|
||||
#ifndef Py_BUFFEROBJECT_H
|
||||
#define Py_BUFFEROBJECT_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
PyAPI_DATA(PyTypeObject) PyBuffer_Type;
|
||||
|
||||
#define PyBuffer_Check(op) (Py_Type(op) == &PyBuffer_Type)
|
||||
|
||||
#define Py_END_OF_BUFFER (-1)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyBuffer_FromObject(PyObject *base,
|
||||
Py_ssize_t offset, Py_ssize_t size);
|
||||
PyAPI_FUNC(PyObject *) PyBuffer_FromReadWriteObject(PyObject *base,
|
||||
Py_ssize_t offset,
|
||||
Py_ssize_t size);
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyBuffer_FromMemory(void *ptr, Py_ssize_t size);
|
||||
PyAPI_FUNC(PyObject *) PyBuffer_FromReadWriteMemory(void *ptr, Py_ssize_t size);
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyBuffer_New(Py_ssize_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* !Py_BUFFEROBJECT_H */
|
||||
@@ -285,7 +285,6 @@ PYTHON_OBJS= \
|
||||
OBJECT_OBJS= \
|
||||
Objects/abstract.o \
|
||||
Objects/boolobject.o \
|
||||
Objects/bufferobject.o \
|
||||
Objects/bytesobject.o \
|
||||
Objects/cellobject.o \
|
||||
Objects/classobject.o \
|
||||
@@ -530,7 +529,6 @@ PYTHON_HEADERS= \
|
||||
Include/asdl.h \
|
||||
Include/abstract.h \
|
||||
Include/boolobject.h \
|
||||
Include/bufferobject.h \
|
||||
Include/bytesobject.h \
|
||||
Include/ceval.h \
|
||||
Include/classobject.h \
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,8 @@ memory_getbuf(PyMemoryViewObject *self, Py_buffer *view, int flags)
|
||||
{
|
||||
if (view != NULL)
|
||||
*view = self->view;
|
||||
if (self->base == NULL)
|
||||
return 0;
|
||||
return self->base->ob_type->tp_as_buffer->bf_getbuffer(self->base, NULL,
|
||||
PyBUF_FULL);
|
||||
}
|
||||
@@ -15,7 +17,8 @@ memory_getbuf(PyMemoryViewObject *self, Py_buffer *view, int flags)
|
||||
static void
|
||||
memory_releasebuf(PyMemoryViewObject *self, Py_buffer *view)
|
||||
{
|
||||
PyObject_ReleaseBuffer(self->base, NULL);
|
||||
if (self->base != NULL)
|
||||
PyObject_ReleaseBuffer(self->base, NULL);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(memory_doc,
|
||||
|
||||
@@ -1051,6 +1051,7 @@ PyObject *PyUnicode_Decode(const char *s,
|
||||
const char *errors)
|
||||
{
|
||||
PyObject *buffer = NULL, *unicode;
|
||||
Py_buffer info;
|
||||
|
||||
if (encoding == NULL)
|
||||
encoding = PyUnicode_GetDefaultEncoding();
|
||||
@@ -1068,7 +1069,10 @@ PyObject *PyUnicode_Decode(const char *s,
|
||||
return PyUnicode_DecodeASCII(s, size, errors);
|
||||
|
||||
/* Decode via the codec registry */
|
||||
buffer = PyBuffer_FromMemory((void *)s, size);
|
||||
buffer = NULL;
|
||||
if (PyBuffer_FillInfo(&info, (void *)s, size, 1, PyBUF_SIMPLE) < 0)
|
||||
goto onError;
|
||||
buffer = PyMemoryView_FromMemory(&info);
|
||||
if (buffer == NULL)
|
||||
goto onError;
|
||||
unicode = PyCodec_Decode(buffer, encoding, errors);
|
||||
|
||||
Reference in New Issue
Block a user