mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-38807: Fix race condition in Lib/trace.py (GH-110143)
Instead of checking if a directory does not exist and thereafter creating it, directly call os.makedirs() with the exist_ok=True.
This commit is contained in:
parent
7573c44c32
commit
78fcde039a
2 changed files with 4 additions and 2 deletions
|
@ -265,8 +265,7 @@ class CoverageResults:
|
||||||
modulename = _modname(filename)
|
modulename = _modname(filename)
|
||||||
else:
|
else:
|
||||||
dir = coverdir
|
dir = coverdir
|
||||||
if not os.path.exists(dir):
|
os.makedirs(dir, exist_ok=True)
|
||||||
os.makedirs(dir)
|
|
||||||
modulename = _fullmodname(filename)
|
modulename = _fullmodname(filename)
|
||||||
|
|
||||||
# If desired, get a list of the line numbers which represent
|
# If desired, get a list of the line numbers which represent
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
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``.
|
Loading…
Add table
Add a link
Reference in a new issue