Skip to content

Commit

Permalink
Yet another disgusting hack for python 3.11.2 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
marmarek committed Mar 7, 2023
1 parent 53ba003 commit 179bc4b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions qubesadmin/backup/restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import tempfile
import termios
import time
import threading
# only for a python bug workaround
import concurrent.futures.thread

Expand Down Expand Up @@ -309,9 +310,19 @@ def _fix_threading_after_fork():
otherwise atexit callback will crash.
https://github.com/python/cpython/issues/88110
And initialize DummyThread locks:
https://github.com/python/cpython/issues/102512
"""
# pylint: disable=protected-access
concurrent.futures.thread._threads_queues.clear()
thread = threading.current_thread()
if isinstance(thread, threading._DummyThread) and \
getattr(thread, '_tstate_lock', "missing") is None:
# mimic threading._after_fork()
thread._set_tstate_lock()
thread._tstate_lock.acquire()



class ExtractWorker3(Process):
Expand Down

0 comments on commit 179bc4b

Please sign in to comment.