[3.14] gh-139653: Add PyUnstable_ThreadState_SetStackProtection() (GH-139668) #141661
[3.14] gh-139653: Add PyUnstable_ThreadState_SetStackProtection() (GH-139668) #141661encukou merged 9 commits intopython:3.14from
Conversation
… limit on macOS (pythonGH-139232) Use `pthread_get_stackaddr_np()` and `pthread_get_stacksize_np()` to determine the stack address and size.
…honGH-139668) Add PyUnstable_ThreadState_SetStackProtection() and PyUnstable_ThreadState_ResetStackProtection() functions to set the stack base address and stack size of a Python thread state. Co-authored-by: Petr Viktorin <encukou@gmail.com>
…pythonGH-141551) These checks were invalid and failed randomly on FreeBSD and Alpine Linux.
|
@hugovk, this will change the internal ABI. |
|
I would prefer to wait to see how the discussion https://discuss.python.org/t/python-3-14-0-is-incompatible-with-stack-switching-systems-what-do-we-do/104880 goes and see if this API solves the issue, or if we need another solution. |
|
If this API cannot be used by most projects and a better fix can be designed, I would even suggest to remove this API from the main branch. |
|
#141404 has been merged causing conflicts. Can you please update your PR to solve conflicts? |
#141711 has been merged: it should fix #139653 for most impacted projects. But according to @markshannon, |
This backports recent changes to the stack protection mechanism, and the unstable API to control it:
📚 Documentation preview 📚: https://cpython-previews--141661.org.readthedocs.build/