mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-14 21:56:56 +03:00
Remove obsolete PyImaging_CheckBuffer and PyImaging_GetBuffer
This commit is contained in:
parent
517c3e1c7f
commit
310f625e60
|
@ -198,22 +198,6 @@ ImagingSectionLeave(ImagingSectionCookie *cookie) {
|
|||
PyEval_RestoreThread((PyThreadState *)*cookie);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* BUFFER HANDLING */
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Python compatibility API */
|
||||
|
||||
int
|
||||
PyImaging_CheckBuffer(PyObject *buffer) {
|
||||
return PyObject_CheckBuffer(buffer);
|
||||
}
|
||||
|
||||
int
|
||||
PyImaging_GetBuffer(PyObject *buffer, Py_buffer *view) {
|
||||
/* must call check_buffer first! */
|
||||
return PyObject_GetBuffer(buffer, view, PyBUF_SIMPLE);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* EXCEPTION REROUTING */
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
@ -4188,19 +4172,19 @@ extern PyObject *
|
|||
PyImaging_GrabScreenX11(PyObject *self, PyObject *args);
|
||||
#endif
|
||||
|
||||
/* Experimental path stuff (in path.c) */
|
||||
/* Path object (in path.c) */
|
||||
extern PyObject *
|
||||
PyPath_Create(ImagingObject *self, PyObject *args);
|
||||
|
||||
/* Experimental outline stuff (in outline.c) */
|
||||
/* Outline object (in outline.c) */
|
||||
extern PyObject *
|
||||
PyOutline_Create(ImagingObject *self, PyObject *args);
|
||||
|
||||
/* MapBuffer implementation (in map.c) */
|
||||
extern PyObject *
|
||||
PyImaging_MapBuffer(PyObject *self, PyObject *args);
|
||||
|
||||
static PyMethodDef functions[] = {
|
||||
|
||||
/* Object factories */
|
||||
{"alpha_composite", (PyCFunction)_alpha_composite, METH_VARARGS},
|
||||
{"blend", (PyCFunction)_blend, METH_VARARGS},
|
||||
|
|
10
src/map.c
10
src/map.c
|
@ -20,12 +20,6 @@
|
|||
|
||||
#include "libImaging/Imaging.h"
|
||||
|
||||
/* compatibility wrappers (defined in _imaging.c) */
|
||||
extern int
|
||||
PyImaging_CheckBuffer(PyObject *buffer);
|
||||
extern int
|
||||
PyImaging_GetBuffer(PyObject *buffer, Py_buffer *view);
|
||||
|
||||
extern PyObject *
|
||||
PyImagingNew(Imaging im);
|
||||
|
||||
|
@ -75,7 +69,7 @@ PyImaging_MapBuffer(PyObject *self, PyObject *args) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!PyImaging_CheckBuffer(target)) {
|
||||
if (!PyObject_CheckBuffer(target)) {
|
||||
PyErr_SetString(PyExc_TypeError, "expected string or buffer");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -103,7 +97,7 @@ PyImaging_MapBuffer(PyObject *self, PyObject *args) {
|
|||
}
|
||||
|
||||
/* check buffer size */
|
||||
if (PyImaging_GetBuffer(target, &view) < 0) {
|
||||
if (PyObject_GetBuffer(target, &view, PyBUF_SIMPLE) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
10
src/path.c
10
src/path.c
|
@ -28,12 +28,6 @@
|
|||
#include "libImaging/Imaging.h"
|
||||
#include "thirdparty/pythoncapi_compat.h"
|
||||
|
||||
/* compatibility wrappers (defined in _imaging.c) */
|
||||
extern int
|
||||
PyImaging_CheckBuffer(PyObject *buffer);
|
||||
extern int
|
||||
PyImaging_GetBuffer(PyObject *buffer, Py_buffer *view);
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Class */
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
@ -123,10 +117,10 @@ PyPath_Flatten(PyObject *data, double **pxy) {
|
|||
return path->count;
|
||||
}
|
||||
|
||||
if (PyImaging_CheckBuffer(data)) {
|
||||
if (PyObject_CheckBuffer(data)) {
|
||||
/* Assume the buffer contains floats */
|
||||
Py_buffer buffer;
|
||||
if (PyImaging_GetBuffer(data, &buffer) == 0) {
|
||||
if (PyObject_GetBuffer(data, &buffer, PyBUF_SIMPLE) == 0) {
|
||||
float *ptr = (float *)buffer.buf;
|
||||
n = buffer.len / (2 * sizeof(float));
|
||||
xy = alloc_array(n);
|
||||
|
|
Loading…
Reference in New Issue
Block a user