Skip to content

Commit 03dba19

Browse files
committed
Be a bit more correct in relation to strict aliasing rules
1 parent 32d9ad4 commit 03dba19

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,13 +381,16 @@ static char *PyDecimalToUTF8Callback(JSOBJ _obj, JSONTypeContext *tc,
381381
Py_DECREF(format_spec);
382382

383383
if (str == NULL) {
384-
*len = 0;
385384
((JSONObjectEncoder *)tc->encoder)->errorMsg = "";
386385
return NULL;
387386
}
388387

389388
GET_TC(tc)->newObj = str;
390-
char *outValue = (char *)PyUnicode_AsUTF8AndSize(str, (Py_ssize_t *)len);
389+
390+
Py_ssize_t s_len = 0;
391+
char *outValue = (char *)PyUnicode_AsUTF8AndSize(str, &s_len);
392+
*len = s_len;
393+
391394
return outValue;
392395
}
393396

0 commit comments

Comments
 (0)