This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients AliyevH, aCuria, erlendaasland, petr.viktorin, serhiy.storchaka, vstinner
Date 2022-03-29.12:53:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1648558397.63.0.805491037114.issue39355@roundup.psfhosted.org>
In-reply-to
Content
When I wrote a PR to use the C header file pythoncapi_compat.h in the datatable C++ project, I got multiple C++ compiler warnings in static inline functions and in some macros:
https://github.com/h2oai/datatable/pull/3231#issuecomment-1032864790

* Usage of NULL
* Usage of "old-style cast" like (ssize_t)1 or (PyObject*)obj

I solved this issue in pythoncapi_compat.h by using reinterpret_cast and nullptr:

* https://github.com/python/pythoncapi_compat/commit/347746379f79fa091017e23427932c9f9980234d
* https://github.com/python/pythoncapi_compat/pull/18
* https://github.com/h2oai/datatable/pull/3237

By the way, pythoncapi_compat.h no longer uses "module":
https://github.com/python/pythoncapi_compat/pull/22

The Python C API has similar issues, but warnings about NULL and old-style cast depend on the C++ compiler flags:

* -Wzero-as-null-pointer-constant
* -Wold-style-cast
History
Date User Action Args
2022-03-29 12:53:17vstinnersetrecipients: + vstinner, petr.viktorin, serhiy.storchaka, erlendaasland, aCuria, AliyevH
2022-03-29 12:53:17vstinnersetmessageid: <1648558397.63.0.805491037114.issue39355@roundup.psfhosted.org>
2022-03-29 12:53:17vstinnerlinkissue39355 messages
2022-03-29 12:53:17vstinnercreate