From c66b4792d745aacb4a848465a767edf87e7ab6b9 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 29 Aug 2017 23:43:51 +0200 Subject: [PATCH] stdpy: protect against thread error when interpreter shuts down --- direct/src/stdpy/thread.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/direct/src/stdpy/thread.py b/direct/src/stdpy/thread.py index 07ed6dad3e..d6146ec997 100644 --- a/direct/src/stdpy/thread.py +++ b/direct/src/stdpy/thread.py @@ -221,6 +221,10 @@ def _get_thread_locals(thread, i): def _remove_thread_id(threadId): """ Removes the thread with the indicated ID from the thread list. """ + # On interpreter shutdown, Python may set module globals to None. + if _threadsLock is None or _threads is None: + return + _threadsLock.acquire() try: thread, locals, wrapper = _threads[threadId]