MCPcopy Index your code
hub / github.com/python/cpython / _prepareFork

Function _prepareFork

Lib/logging/__init__.py:228–240  ·  view source on GitHub ↗

Prepare to fork a new child process by acquiring the module-level lock. This should be used in conjunction with _afterFork().

()

Source from the content-addressed store, hash-verified

226_lock = threading.RLock()
227
228def _prepareFork():
229 """
230 Prepare to fork a new child process by acquiring the module-level lock.
231
232 This should be used in conjunction with _afterFork().
233 """
234 # Wrap the lock acquisition in a try-except to prevent the lock from being
235 # abandoned in the event of an asynchronous exception. See gh-106238.
236 try:
237 _lock.acquire()
238 except BaseException:
239 _lock.release()
240 raise
241
242def _afterFork():
243 """

Callers

nothing calls this directly

Calls 2

acquireMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…