-
Kirill Smelkov authored
Gevent runtime uses python-level calls internally which might interfere with current python state. For example if current python exception is set, and e.g. go or makesema runtime call is made, the following happens: golang/golang_test.py::test_pyx_runtime_vs_pyexc RuntimeError: abc The above exception was the direct cause of the following exception: SystemError: <class 'gevent.__semaphore.Semaphore'> returned a result with an error set Exception ignored in: 'golang.runtime._runtime_gevent._sema_alloc' SystemError: <class 'gevent.__semaphore.Semaphore'> returned a result with an error set terminate called after throwing an instance of 'golang::PanicError' what(): makesema: alloc failed Fatal Python error: Aborted -> Fix all functions in the runtimes that work at Python level to save/restore Python-level exception on entry/exit. This is mostly gevent runtime, but also a couple of non-posix fallbacks in thread runtime. The bug was there from day 1 of runtimes - from ce8152a2 (pyx api: Provide sleep), f971a2a8 (pyx api: Provide go) and 69db91bf (libgolang: Add internal semaphores).
47fac0a9