In the PEP, don't assign an int to a pointer. Point to a static constant as a sentinel.
gpshead opened this issue · 1 comments
gpshead commented
In pep.rst you currently have const PyJittedCode *PY_JIT_FAILED = 1;
and suggest "The value should be a memory address that has nearly no chance of ever being a valid memory address to a PyJittedCode struct".
Rather than assigning an int to a pointer (unwise), it would be better to declare a static sentinel value and have PY_JIT_FAILED be the address of that. Likely something of this flavor:
static uint32 _py_jit_failed_sentinel = 0xdeadc0de;
PyJittedCode *PY_JIT_FAILED = (PyJittedCode*)&_py_jit_failed_sentinel;
brettcannon commented
FYI there's a major rewrite of the PEP coming where this will no longer be within the purview of CPython. 😄 I should have the rewrite up some time this week.