Skip to content

Commit cf458cf

Browse files
committed
COMPAT: PyPy can only call PyList_GET_SIZE on a PyListObject
1 parent db08da2 commit cf458cf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pandas/src/ujson/python/JSONtoObj.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,11 @@ int Object_npyObjectAddKey(void *prv, JSOBJ obj, JSOBJ name, JSOBJ value) {
427427

428428
// only fill label array once, assumes all column labels are the same
429429
// for 2-dimensional arrays.
430+
#ifdef PYPY_VERSION
431+
if (PyObject_GET_SIZE(npyarr->labels[labelidx]) <= npyarr->elcount) {
432+
#else
430433
if (PyList_GET_SIZE(npyarr->labels[labelidx]) <= npyarr->elcount) {
434+
#endif
431435
PyList_Append(npyarr->labels[labelidx], label);
432436
}
433437

0 commit comments

Comments
 (0)