New submission from Colas Le Guernic <colas.le.guer...@gmail.com>:
Yet another weird bug when one creates sub-processes from threads. I found several issues mentioning ThreadPoolExecutor and subprocess.run but I believe this one is different. When creating a temporary directory with tempfile.TemporaryDirectory (with or without context manager) it is sometimes deleted by a call to subprocess.run when both occurs inside a task sent to a ThreadPoolExecutor created without a context manager (that last part is very odd). Running the attached file on python 3.8.5 or 3.8.10 shows the issue only occurs if the executor is not created through a context manager. The bug does not seem to occur on python 3.9.5 or 3.10.0b1. Using a ProcessPoolExecutor seems to fix the issue too. ---------- files: test_tmpdir.py messages: 393436 nosy: colas.le.guernic priority: normal severity: normal status: open title: tempfile.TemporaryDirectory deleted after call to subprocess.run in threads type: behavior versions: Python 3.8 Added file: https://bugs.python.org/file50035/test_tmpdir.py _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44105> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com