fix-segfault-with-pydebug.patch 764 B

1234567891011121314151617181920
  1. commit fc804aedfe1e844aaed4aa196830ca057f89361c (HEAD)
  2. author: shadchin
  3. date: 2024-02-07T11:13:39+03:00
  4. Fix segfault
  5. --- contrib/tools/python3/Python/pystate.c (bacb745829a9c01a81284c346946097c868084e0)
  6. +++ contrib/tools/python3/Python/pystate.c (fc804aedfe1e844aaed4aa196830ca057f89361c)
  7. @@ -354,6 +354,11 @@ holds_gil(PyThreadState *tstate)
  8. // XXX Fall back to tstate->interp->runtime->ceval.gil.last_holder
  9. // (and tstate->interp->runtime->ceval.gil.locked).
  10. assert(tstate != NULL);
  11. +#ifndef NDEBUG
  12. + if (!tstate_is_alive(tstate)) {
  13. + return PyGILState_Check();
  14. + }
  15. +#endif
  16. _PyRuntimeState *runtime = tstate->interp->runtime;
  17. /* Must be the tstate for this thread */
  18. assert(tstate == gilstate_tss_get(runtime));