Skip to content

Simplified objToJSON signatures #30271

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

Closed
wants to merge 3 commits into from

Conversation

WillAyd
Copy link
Member

@WillAyd WillAyd commented Dec 14, 2019

Pre-cursor to a change that splits datetime functions that return char * off from datetime functions that return int. Right now these are intermixed in functions that return void pointers, which makes type checking and grokking more difficult than they need to be

@WillAyd WillAyd added the IO JSON read_json, to_json, json_normalize label Dec 14, 2019
@@ -509,7 +501,7 @@ static void *PyTimeToJSON(JSOBJ _obj, JSONTypeContext *tc, void *outValue,
GET_TC(tc)->newObj = str;

*outLen = PyBytes_GET_SIZE(str);
outValue = (void *)PyBytes_AS_STRING(str);
char *outValue = PyBytes_AS_STRING(str);
Copy link
Member

Choose a reason for hiding this comment

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

this looks like it should have implications for the return type of this function. is the returned outValue ever used?

Copy link
Member Author

Choose a reason for hiding this comment

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

In the scope of this function the current assignment to outValue goes nowhere. Particularly for strings it has no use, as Object_getString ignores it altogether. Definitely confusing

Goal in the next PR(s) is to split out all of these functions that return void pointers into functions that return either char * or int to streamline things and make readable

Copy link
Member

Choose a reason for hiding this comment

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

Thanks. Pending green, LGTM.

@WillAyd
Copy link
Member Author

WillAyd commented Dec 15, 2019

Hmm I don't think there's a way to make this intermediate step work so closing

@WillAyd WillAyd closed this Dec 15, 2019
@jbrockmendel
Copy link
Member

Nothing more eyeballs could do to help? This looked like a nice cleanup.

@WillAyd
Copy link
Member Author

WillAyd commented Dec 15, 2019

I think its just an architectural limitation trying to return a 64 bit integer from a void * which I think is 32 bits on a 32 bit platform, but if you see something different for sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO JSON read_json, to_json, json_normalize
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants