MCPcopy Create free account
hub / github.com/python/cpython / my_mkdir

Method my_mkdir

Lib/test/test_pathlib/test_pathlib.py:2471–2481  ·  view source on GitHub ↗
(path, mode=0o777)

Source from the content-addressed store, hash-verified

2469
2470 real_mkdir = os.mkdir
2471 def my_mkdir(path, mode=0o777):
2472 path = str(path)
2473 # Emulate another process that would create the directory
2474 # just before we try to create it ourselves. We do it
2475 # in all possible pattern combinations, assuming that this
2476 # function is called at most 5 times (dirCPC/dir1/dir2,
2477 # dirCPC/dir1, dirCPC, dirCPC/dir1, dirCPC/dir1/dir2).
2478 if pattern.pop():
2479 real_mkdir(path, mode) # From another process.
2480 concurrently_created.add(path)
2481 real_mkdir(path, mode) # Our real call.
2482
2483 pattern = [bool(pattern_num & (1 << n)) for n in range(5)]
2484 concurrently_created = set()

Callers

nothing calls this directly

Calls 3

strFunction · 0.85
popMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected