Can I comment out enum __pyx_check_sizeof_voidp?

83 views
Skip to first unread message

xy l

unread,
Apr 19, 2022, 5:01:41 AM4/19/22
to cython-users
Hello, Guys,
  Python 2.7.15, Cython 0.29.8

  #define SIZEOF_VOID_P 4 in pyconfig.h

  It seems that sizeof(void *) is equal to 8.  So I think the definition is always an invalid one.

   enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };

   I am not sure that there will be some bad effect after I change SIZEOF_VOID_P to 8. So can I comment out the enum definition brute force?

Thank you

da-woods

unread,
Apr 19, 2022, 1:37:39 PM4/19/22
to cython...@googlegroups.com
>    I am not sure that there will be some bad effect after I change SIZEOF_VOID_P to 8. So can I comment out the enum definition brute force?

No - this is absolutely the wrong thing to do.

The fact you have SIZEOF_VOID_P 4 in pyconfig.h suggests your environment is set up wrongly (probably you are trying to use MinGW, which isn't really supported). This and other wrong constants will end up being used by both Cython and in the Python headers.

The enum included in Cython is a basic safety check to make sure that you have a consistent environment to compile in.

Therefore you should not comment out the enum and you should not modify pyconfig.h. Instead you should work out how to get a correct compilation environment. (Assuming you're using MinGW you might look at https://stackoverflow.com/questions/70654722/how-to-create-c-extension-embed-python-with-mingw-w64-on-windows. Remember that MinGW isn't really supported though, so you may run into other issues.)
--

---
You received this message because you are subscribed to the Google Groups "cython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cython-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cython-users/51190ff1-b4be-4084-9cf1-6644862aec28n%40googlegroups.com.


Reply all
Reply to author
Forward
0 new messages