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 8, 2023
1 parent 53ba003 commit a9b17d9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 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,18 @@ 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()



class ExtractWorker3(Process):
Expand Down

0 comments on commit a9b17d9

Please sign in to comment.