Description
While working on the meson build integration, I've discovered that the JSON Module is doing some sketchy things.
-
The ujson extension module should not be named json.
This can result in a really nasty segfault, since our ujson module tries to initialize numpy's array api(via
import_array
). In the C code on numpy's side, numpy then tries to import itself. During this process, it needs to initialize its version process via versionneer. Well, it turns out versioneer needs to import json to figure out version stuff. If versioneer picks up pandas' json module, bad things happen since its like a circular import but worse (best case: Python exception saying json failed to initialize, worst case: segfault). -
We are using POSIX functions.
If you're not paying attention to the build warnings, you'll get a segfault, since in C99 mode strdup gets excluded from string.h declarations. Now, Fix build warning for use of
strdup
in ultrajson #48369 was supposed to fix this so I'm not sure what's going on here.
All in all, this burned like a week of my time, so it would be nice to fix this sometime soon.
cc @WillAyd