Skip to content

Commit 482f996

Browse files
WillAydproost
authored andcommitted
Remove Dead JSON Code (pandas-dev#30174)
1 parent 9e5fb13 commit 482f996

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

pandas/_libs/src/ujson/python/objToJSON.c

-36
Original file line numberDiff line numberDiff line change
@@ -531,26 +531,8 @@ static void *PyTimeToJSON(JSOBJ _obj, JSONTypeContext *tc, void *outValue,
531531
static int NpyTypeToJSONType(PyObject *obj, JSONTypeContext *tc, int npyType,
532532
void *value) {
533533
PyArray_VectorUnaryFunc *castfunc;
534-
npy_double doubleVal;
535534
npy_int64 longVal;
536535

537-
if (PyTypeNum_ISFLOAT(npyType)) {
538-
PRINTMARK();
539-
castfunc =
540-
PyArray_GetCastFunc(PyArray_DescrFromType(npyType), NPY_DOUBLE);
541-
if (!castfunc) {
542-
PyErr_Format(PyExc_ValueError,
543-
"Cannot cast numpy dtype %d to double", npyType);
544-
}
545-
castfunc(value, &doubleVal, 1, NULL, NULL);
546-
if (npy_isnan(doubleVal) || npy_isinf(doubleVal)) {
547-
PRINTMARK();
548-
return JT_NULL;
549-
}
550-
GET_TC(tc)->doubleValue = (double)doubleVal;
551-
return JT_DOUBLE;
552-
}
553-
554536
if (PyTypeNum_ISDATETIME(npyType)) {
555537
PRINTMARK();
556538
castfunc =
@@ -581,24 +563,6 @@ static int NpyTypeToJSONType(PyObject *obj, JSONTypeContext *tc, int npyType,
581563
}
582564
}
583565

584-
if (PyTypeNum_ISINTEGER(npyType)) {
585-
PRINTMARK();
586-
castfunc =
587-
PyArray_GetCastFunc(PyArray_DescrFromType(npyType), NPY_INT64);
588-
if (!castfunc) {
589-
PyErr_Format(PyExc_ValueError, "Cannot cast numpy dtype %d to long",
590-
npyType);
591-
}
592-
castfunc(value, &longVal, 1, NULL, NULL);
593-
GET_TC(tc)->longValue = (JSINT64)longVal;
594-
return JT_LONG;
595-
}
596-
597-
if (PyTypeNum_ISBOOL(npyType)) {
598-
PRINTMARK();
599-
return *((npy_bool *)value) == NPY_TRUE ? JT_TRUE : JT_FALSE;
600-
}
601-
602566
PRINTMARK();
603567
return JT_INVALID;
604568
}

0 commit comments

Comments
 (0)