[issue23649] tarfile not re-entrant for multi-threading
Srdjan Grubor
report at bugs.python.org
Thu Mar 12 17:52:03 CET 2015
Srdjan Grubor added the comment:
The code around tarfile multi-threading was fixed for me on the user-side with threading.Lock() usage so it might work to use this within the library and the directory creation could be improved by probably doing a try/except around the makedirs() call with ignoring of the exception if it's FileExistsError - my code I use elsewhere fixes this with:
def _safe_makedirs(self, dir_path):
try:
makedirs(dir_path)
# Concurrency problems need to be handled. If two threads create
# the same dir, there might be a race between them checking and
# doing makedirs so we handle that as gracefully as possible here.
except FileExistsError as fee:
if not os.path.isdir(dir_path):
raise fee
If I get time, I'll submit a patch but it seems like I probably won't for this.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23649>
_______________________________________
More information about the Python-bugs-list
mailing list