Skip to content

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

Merged
merged 5 commits into from
Jan 20, 2020
Merged

Split out JSON Date Converters #31057

merged 5 commits into from
Jan 20, 2020

Conversation

WillAyd
Copy link
Member

@WillAyd WillAyd commented Jan 16, 2020

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

@pep8speaks
Copy link

pep8speaks commented Jan 16, 2020

Hello @WillAyd! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-01-20 17:16:31 UTC

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);
Copy link
Member Author

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

@WillAyd WillAyd added the Clean label Jan 16, 2020
@@ -0,0 +1,118 @@
// Conversion routines that are useful for seralization,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seralization -> serialization

@jbrockmendel
Copy link
Member

seems like a good refactor.

Out of curiosity, what is the big picture gameplan for the json code?

@WillAyd
Copy link
Member Author

WillAyd commented Jan 16, 2020

Just trying to make more readable / scalable and learn more about C

@jbrockmendel
Copy link
Member

LGTM cc @jreback

@jreback
Copy link
Contributor

jreback commented Jan 18, 2020

can you rebase

@WillAyd
Copy link
Member Author

WillAyd commented Jan 20, 2020

rebased and green

@jreback jreback added this to the 1.1 milestone Jan 20, 2020
@jreback jreback added the IO JSON read_json, to_json, json_normalize label Jan 20, 2020
@jreback jreback merged commit 8a8e967 into pandas-dev:master Jan 20, 2020
@jreback
Copy link
Contributor

jreback commented Jan 20, 2020

lgtm. thanks @WillAyd

@WillAyd WillAyd deleted the json-reorg branch April 12, 2023 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean IO JSON read_json, to_json, json_normalize
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants