Message416363
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 (...) |
|
Date |
User |
Action |
Args |
2022-03-30 14:33:08 | vstinner | set | recipients:
+ vstinner, Mark.Shannon, kj |
2022-03-30 14:33:08 | vstinner | set | messageid: <1648650788.22.0.385513615036.issue47164@roundup.psfhosted.org> |
2022-03-30 14:33:08 | vstinner | link | issue47164 messages |
2022-03-30 14:33:08 | vstinner | create | |
|