Skip to content

MAINT: Remove use of PyArray_GetCastFunc #55996

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
seberg opened this issue Nov 16, 2023 · 1 comment · Fixed by #56114
Closed

MAINT: Remove use of PyArray_GetCastFunc #55996

seberg opened this issue Nov 16, 2023 · 1 comment · Fixed by #56114
Assignees
Labels
Clean IO JSON read_json, to_json, json_normalize

Comments

@seberg
Copy link
Contributor

seberg commented Nov 16, 2023

pandas uses PyArray_GetCastFunc in the json reader (or writer). As far as I can tell, it is used only for simple NumPy numeric types.

I want to remove this from NumPy, because for many years NumPy never uses those cast functions internally (OK, a few were never replaced but not most are unused).
From glancing at it, I think you can just add a few branches and cast manually. If needed, I could create a new PyArray_CastBuffer() function, but I suspect that would just add overhead for something that is simple enough.

EDIT: I will add the note, that the castfunc never deals with unaligned or memory or byteswapping. So this is really just a C cast.

@lithomas1 lithomas1 added IO JSON read_json, to_json, json_normalize Clean labels Nov 16, 2023
@lithomas1
Copy link
Member

Yeah, I think we are just casting scalar dt64 to int64. I'll take a look.

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 a pull request may close this issue.

2 participants