Skip to content

Remove Dead JSON Code #30174

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

Merged
merged 2 commits into from
Dec 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions pandas/_libs/src/ujson/python/objToJSON.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,26 +531,8 @@ static void *PyTimeToJSON(JSOBJ _obj, JSONTypeContext *tc, void *outValue,
static int NpyTypeToJSONType(PyObject *obj, JSONTypeContext *tc, int npyType,
void *value) {
PyArray_VectorUnaryFunc *castfunc;
npy_double doubleVal;
npy_int64 longVal;

if (PyTypeNum_ISFLOAT(npyType)) {
PRINTMARK();
castfunc =
PyArray_GetCastFunc(PyArray_DescrFromType(npyType), NPY_DOUBLE);
if (!castfunc) {
PyErr_Format(PyExc_ValueError,
"Cannot cast numpy dtype %d to double", npyType);
}
castfunc(value, &doubleVal, 1, NULL, NULL);
if (npy_isnan(doubleVal) || npy_isinf(doubleVal)) {
PRINTMARK();
return JT_NULL;
}
GET_TC(tc)->doubleValue = (double)doubleVal;
return JT_DOUBLE;
}

if (PyTypeNum_ISDATETIME(npyType)) {
PRINTMARK();
castfunc =
Expand Down Expand Up @@ -581,24 +563,6 @@ static int NpyTypeToJSONType(PyObject *obj, JSONTypeContext *tc, int npyType,
}
}

if (PyTypeNum_ISINTEGER(npyType)) {
PRINTMARK();
castfunc =
PyArray_GetCastFunc(PyArray_DescrFromType(npyType), NPY_INT64);
if (!castfunc) {
PyErr_Format(PyExc_ValueError, "Cannot cast numpy dtype %d to long",
npyType);
}
castfunc(value, &longVal, 1, NULL, NULL);
GET_TC(tc)->longValue = (JSINT64)longVal;
return JT_LONG;
}

if (PyTypeNum_ISBOOL(npyType)) {
PRINTMARK();
return *((npy_bool *)value) == NPY_TRUE ? JT_TRUE : JT_FALSE;
}

PRINTMARK();
return JT_INVALID;
}
Expand Down