-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Split out JSON Date Converters #31057
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
Conversation
char *PyDateTimeToIso(PyDateTime_Date *obj, NPY_DATETIMEUNIT base, size_t *len); | ||
|
||
// Convert a Python Date/Datetime to Unix epoch with resolution base | ||
npy_datetime PyDateTimeToEpoch(PyDateTime_Date *dt, NPY_DATETIMEUNIT base); |
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.
As a minor detail I had to modify the signature of this which previously accepted a PyObject and perform a PyDateTime_Check
call. The problem with moving that into a separate file is that you need to call PyDateTime_IMPORT
to set an object with static duration in this file separate from what is already in objToJSON.c
and there's not a great place to really set that.
We didn't explicitly do anything with the check previously and this aligns better with PyDateTimeToIso
so I think not a big deal
@@ -0,0 +1,118 @@ | |||
// Conversion routines that are useful for seralization, |
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.
seralization -> serialization
seems like a good refactor. Out of curiosity, what is the big picture gameplan for the json code? |
Just trying to make more readable / scalable and learn more about C |
LGTM cc @jreback |
can you rebase |
rebased and green |
lgtm. thanks @WillAyd |
This file is pretty large so trying to make more modular. This separates out conversion routines required for getting from the Python space to JSON, but which don't actually serialize the data