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 Mark.Shannon, kj, vstinner
Date 2022-03-30.14:33:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1648650788.22.0.385513615036.issue47164@roundup.psfhosted.org>
In-reply-to
Content
GH-32192 "Add _PyCFunction_CAST() macro" is special. It's used to define functions in PyTypeObject.tp_methods or PyModuleDef.m_methods.

Casting a function pointer can cause issues with Control Flow Integrity (CFI) implemented in LLVM. The _thread module has an undefined behavior fixed by the commit 9eea6eaf23067880f4af3a130e3f67c9812e2f30 of bpo-33015. Previously, a cast ignored that the callback has no return value, whereas pthread_create() requires a function which as a void* return value.

To fix compiler warnings, the (PyCFunction)func cast was replaced with the (PyCFunction)(void(*)(void))func cast to fix bpo-bpo-33012 GCC 8 compiler warning:

    warning: cast between incompatible function types (...)
History
Date User Action Args
2022-03-30 14:33:08vstinnersetrecipients: + vstinner, Mark.Shannon, kj
2022-03-30 14:33:08vstinnersetmessageid: <1648650788.22.0.385513615036.issue47164@roundup.psfhosted.org>
2022-03-30 14:33:08vstinnerlinkissue47164 messages
2022-03-30 14:33:08vstinnercreate