summaryrefslogtreecommitdiffstats
path: root/Lib/trace.py
diff options
context:
space:
mode:
authorbuermarc <44375277+buermarc@users.noreply.github.com>2024-01-17 20:02:14 (GMT)
committerGitHub <noreply@github.com>2024-01-17 20:02:14 (GMT)
commit78fcde039a33d8463e34356d5462fecee0f2831a (patch)
treef4056e00ab6ee8e6f15e496dbedb24a66c23d9ae /Lib/trace.py
parent7573c44c3278eacf0233146037d843bb2563877a (diff)
downloadcpython-78fcde039a33d8463e34356d5462fecee0f2831a.zip
cpython-78fcde039a33d8463e34356d5462fecee0f2831a.tar.gz
cpython-78fcde039a33d8463e34356d5462fecee0f2831a.tar.bz2
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.
Diffstat (limited to 'Lib/trace.py')
-rwxr-xr-xLib/trace.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/Lib/trace.py b/Lib/trace.py
index 7cb6f89..7886959 100755
--- a/Lib/trace.py
+++ b/Lib/trace.py
@@ -265,8 +265,7 @@ class CoverageResults:
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