Skip to content

Commit

Permalink
Call PyObject_GetBuffer directly, fix pypy fail
Browse files Browse the repository at this point in the history
  • Loading branch information
ankith26 committed Dec 31, 2023
1 parent ff970cd commit cee68fa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src_c/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -1148,12 +1148,9 @@ pgObject_GetBuffer(PyObject *obj, pg_buffer *pg_view_p, int flags)
flags |= PyBUF_PYGAME;
#endif

if (PyObject_CheckBuffer(obj)) {
if (PyObject_GetBuffer(obj, view_p, flags) == 0) {
char *fchar_p;

if (PyObject_GetBuffer(obj, view_p, flags)) {
return -1;
}
pg_view_p->release_buffer = PyBuffer_Release;

/* Check the format is a numeric type or pad bytes
Expand Down Expand Up @@ -1225,6 +1222,9 @@ pgObject_GetBuffer(PyObject *obj, pg_buffer *pg_view_p, int flags)
}
success = 1;
}
else {
PyErr_Clear();
}

if (!success && pgGetArrayStruct(obj, &cobj, &inter_p) == 0) {
if (pgArrayStruct_AsBuffer(pg_view_p, cobj, inter_p, flags)) {
Expand Down

0 comments on commit cee68fa

Please sign in to comment.