Instead of checking if a directory does not exist and thereafter
creating it, directly call os.makedirs() with the exist_ok=True.
modulename = _modname(filename)
else:
dir = coverdir
- if not os.path.exists(dir):
- os.makedirs(dir)
+ os.makedirs(dir, exist_ok=True)
modulename = _fullmodname(filename)
# If desired, get a list of the line numbers which represent
--- /dev/null
+Fix race condition in :mod:`trace`. Instead of checking if a directory
+exists and creating it, directly call :func:`os.makedirs` with the kwarg
+``exist_ok=True``.