Skip to content

CLN: Fix return type for initObjToJSON() #5334

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 1 commit into from
Oct 26, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/source/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,8 @@ Bug Fixes
- Bug when trying to display an embedded PandasObject (:issue:`5324`)
- Allows operating of Timestamps to return a datetime if the result is out-of-bounds
related (:issue:`5312`)
- Fix return value/type signature of ``initObjToJSON()`` to be compatible
with numpy's ``import_array()`` (:issue:`5334`, :issue:`5326`)

pandas 0.12.0
-------------
Expand Down
10 changes: 6 additions & 4 deletions pandas/src/ujson/python/objToJSON.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,11 @@ enum PANDAS_FORMAT
//#define PRINTMARK() fprintf(stderr, "%s: MARK(%d)\n", __FILE__, __LINE__)
#define PRINTMARK()

#if (PY_VERSION_HEX < 0x03000000)
void initObjToJSON(void)
// import_array() compat
#if (PY_VERSION_HEX >= 0x03000000)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

flipped this to match numpy's format for clarity.

void *initObjToJSON(void)
#else
int initObjToJSON(void)
void initObjToJSON(void)
#endif
{
PyObject *mod_pandas;
Expand Down Expand Up @@ -176,8 +177,9 @@ int initObjToJSON(void)
Py_DECREF(mod_tslib);
}

/* Initialise numpy API */
/* Initialise numpy API and use 2/3 compatible return */
import_array();
return NUMPY_IMPORT_ARRAY_RETVAL;
}

static void *PyIntToINT32(JSOBJ _obj, JSONTypeContext *tc, void *outValue, size_t *_outLen)
Expand Down