Skip to content
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

Fix build errors on recent macOS versions. #150

Merged
merged 4 commits into from
May 17, 2024
Merged

Conversation

icemac
Copy link
Member

@icemac icemac commented May 15, 2024

Traceback without these changes
py311: packaging backend failed (code=error: command '/usr/bin/clang' failed with exit code 1), with SystemExit: error: command '/usr/bin/clang' failed with exit code 1
src/AccessControl/cAccessControl.c:428:2: error: incompatible pointer to integer conversion initializing 'Py_ssize_t' (aka 'long') with an expression of type 'void *'
      [-Wint-conversion]
        NULL,                                   /* tp_print     */
        ^~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types/_null.h:30:15: note: expanded from macro 'NULL'
#define NULL  __DARWIN_NULL
              ^~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:52:23: note: expanded from macro '__DARWIN_NULL'
#define __DARWIN_NULL ((void *)0)
                      ^~~~~~~~~~~
src/AccessControl/cAccessControl.c:487:2: error: incompatible pointer to integer conversion initializing 'Py_ssize_t' (aka 'long') with an expression of type 'void *'
      [-Wint-conversion]
        NULL,                                   /* tp_print     */
        ^~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types/_null.h:30:15: note: expanded from macro 'NULL'
#define NULL  __DARWIN_NULL
              ^~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:52:23: note: expanded from macro '__DARWIN_NULL'
#define __DARWIN_NULL ((void *)0)
                      ^~~~~~~~~~~
src/AccessControl/cAccessControl.c:546:2: error: incompatible pointer to integer conversion initializing 'Py_ssize_t' (aka 'long') with an expression of type 'void *'
      [-Wint-conversion]
        NULL,                                   /* tp_print     */
        ^~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types/_null.h:30:15: note: expanded from macro 'NULL'
#define NULL  __DARWIN_NULL
              ^~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:52:23: note: expanded from macro '__DARWIN_NULL'
#define __DARWIN_NULL ((void *)0)
                      ^~~~~~~~~~~
src/AccessControl/cAccessControl.c:616:2: error: incompatible pointer to integer conversion initializing 'Py_ssize_t' (aka 'long') with an expression of type 'void *'
      [-Wint-conversion]
        NULL,                                   /* tp_print     */
        ^~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types/_null.h:30:15: note: expanded from macro 'NULL'
#define NULL  __DARWIN_NULL
              ^~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/include/sys/_types.h:52:23: note: expanded from macro '__DARWIN_NULL'
#define __DARWIN_NULL ((void *)0)
                      ^~~~~~~~~~~
4 errors generated.

I am running on Sonoma 14.4.1 on an Apple chip.

The PyExtensionClass is actually a PyTypeObject and the examples in the Python docs also use a 0 here instead of NULL: https://docs.python.org/3/c-api/typeobj.html#typedef-examples

@icemac icemac requested review from dataflake and d-maurer May 15, 2024 06:22
@icemac icemac self-assigned this May 15, 2024
@icemac
Copy link
Member Author

icemac commented May 15, 2024

I have no idea about the failures when pushing to coveralls.

@icemac
Copy link
Member Author

icemac commented May 15, 2024

I also saw the coveralls errors in zope.deprecation, so I created TheKevJames/coveralls-python#440

Copy link
Contributor

@d-maurer d-maurer left a comment

Choose a reason for hiding this comment

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

Python 3.8+ has reused the slot used for tp_print in Python 2 (and therefore had as type a function pointer) as tp_vectorcall_offset (now a size slot).

I suggest to not only use a type correct initializer for the slot but also change the explanatory comment.

src/AccessControl/cAccessControl.c Outdated Show resolved Hide resolved
src/AccessControl/cAccessControl.c Outdated Show resolved Hide resolved
src/AccessControl/cAccessControl.c Outdated Show resolved Hide resolved
@icemac icemac requested a review from d-maurer May 15, 2024 07:56
@icemac
Copy link
Member Author

icemac commented May 15, 2024

@d-maurer Thank you for your suggestions, could you please re-review?

src/AccessControl/cAccessControl.c Outdated Show resolved Hide resolved
@icemac icemac merged commit d8363b5 into master May 17, 2024
38 checks passed
@icemac icemac deleted the fix-macos-build-errors branch May 17, 2024 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants