diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-10-14 10:36:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-10-14 10:52:02 +0300 |
commit | 5edba9b42f684bf8b99894bb6988e7f46180e12c (patch) | |
tree | 98bf5b1515a36eb2fe846dc4d1be57caf34b6e19 /tests/python | |
parent | 2d4f1afece18e46bfab3d6b383a099d89975eefb (diff) |
Fix T81688: BPY_thread_save crashes with Python 3.9
Calling PyEval_ReleaseLock() was crashing with Python 3.9
because it accessed the NULL pointer set by PyThreadState_Swap().
This happened when calling ViewLayer.update() for example.
While the existing logic could be fixed by swapping the thread-state
back before calling PyEval_ReleaseLock(), this depends on functions
which are tagged to be removed by v4.0.
Replace use of deprecated functions by calling PyEval_SaveThread(),
instead of inlining the logic, using _PyThreadState_UncheckedGet()
to prevent Python aborting.
The call to PyEval_ThreadsInitialized has been removed
as threads are now initialized with Python.
This could be replaced with Py_IsInitialized() however it doesn't look
like this is necessary.
This is compatible with Python 3.7 & 3.9.
Diffstat (limited to 'tests/python')
0 files changed, 0 insertions, 0 deletions