mirror of
https://github.com/python/cpython.git
synced 2025-08-10 03:49:18 +00:00
[3.12] gh-38807: Fix race condition in Lib/trace.py (GH-110143) (GH-114206)
Instead of checking if a directory does not exist and thereafter
creating it, directly call os.makedirs() with the exist_ok=True.
(cherry picked from commit 78fcde039a
)
Co-authored-by: buermarc <44375277+buermarc@users.noreply.github.com>
This commit is contained in:
parent
a735fea6b1
commit
24d23929d6
2 changed files with 4 additions and 2 deletions
|
@ -258,8 +258,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