Skip to content

Conversation

@WillAyd
Copy link
Member

@WillAyd WillAyd commented Dec 4, 2023

Need to merge in #56277 first then make sure this doesn't cause issues on other platforms, but seems to work for gcc


static PyMethodDef ujsonMethods[] = {
{"ujson_dumps", (PyCFunction)objToJSON, METH_VARARGS | METH_KEYWORDS,
{"ujson_dumps", (PyCFunction)(void (*)(void))objToJSON,
Copy link
Member Author

Choose a reason for hiding this comment

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

I find this cast here a bit strange but it is what CPython has in their documentation for functions that accept kwargs

https://docs.python.org/3/extending/extending.html#keyword-parameters-for-extension-functions

@mroeschke mroeschke added the Build Library building on various platforms label Dec 7, 2023
#define toupper_ascii(c) ((((unsigned)(c) - 'a') < 26) ? ((c) & 0x5f) : (c))
#define tolower_ascii(c) ((((unsigned)(c) - 'A') < 26) ? ((c) | 0x20) : (c))

#define UNUSED(x) (void)(x)
Copy link
Member

Choose a reason for hiding this comment

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

Just curious why this is needed

Copy link
Member Author

Choose a reason for hiding this comment

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

Unused parameters trigger a warning, and there is no cross platform way to silence them. Gcc/clang have an unused attribute. I'm not aware of something for MSVC

Python offers a Py_UNUSED macro for this purpose too. Let me see if we can switch over to that so it's one less thing we manage

@mroeschke mroeschke added this to the 2.2 milestone Dec 9, 2023
@mroeschke mroeschke merged commit 1ab4d03 into pandas-dev:main Dec 9, 2023
@mroeschke
Copy link
Member

Thanks @WillAyd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Build Library building on various platforms

2 participants