-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: to_json failing on PyPy #40525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: to_json failing on PyPy #40525
Changes from 5 commits
197a2f1
b1f4bcc
fc59ec4
16d13d0
0900f23
f606811
6582051
51f37e0
9af4785
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,6 +144,7 @@ typedef struct __PyObjectEncoder { | |
enum PANDAS_FORMAT { SPLIT, RECORDS, INDEX, COLUMNS, VALUES }; | ||
|
||
int PdBlock_iterNext(JSOBJ, JSONTypeContext *); | ||
static Py_ssize_t get_attr_length(PyObject *obj, char *attr); | ||
|
||
void *initObjToJSON(void) { | ||
PyObject *mod_pandas; | ||
|
@@ -273,14 +274,13 @@ static PyObject *get_sub_attr(PyObject *obj, char *attr, char *subAttr) { | |
} | ||
|
||
static int is_simple_frame(PyObject *obj) { | ||
PyObject *check = get_sub_attr(obj, "_mgr", "is_mixed_type"); | ||
int ret = (check == Py_False); | ||
|
||
if (!check) { | ||
PyObject *mgr = PyObject_GetAttrString(obj, "_mgr"); | ||
if (!mgr) { | ||
return 0; | ||
} | ||
int ret = (get_attr_length(mgr, "blocks") <= 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm I'm not really sure about this change. The problem with how this code is currently set up is that when Do we have test coverage for DataFrames that only contain 1 block of an extension array? If not I'd be worried this could change things that we aren't testing currently There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't see any coverage, have added some simple tests for the one |
||
|
||
Py_DECREF(check); | ||
Py_DECREF(mgr); | ||
return ret; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than forward declaring this can you just swap the position the of
get_attr_length
andis_simple_frame
functions?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will make that change