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

Method __enter__

Lib/importlib/_bootstrap.py:162–171  ·  view source on GitHub ↗

Mark the running thread as waiting for self.lock. via _blocking_on.

(self)

Source from the content-addressed store, hash-verified

160 self.lock = lock
161
162 def __enter__(self):
163 """Mark the running thread as waiting for self.lock. via _blocking_on."""
164 # Interactions with _blocking_on are *not* protected by the global
165 # import lock here because each thread only touches the state that it
166 # owns (state keyed on its thread id). The global import lock is
167 # re-entrant (i.e., a single thread may take it more than once) so it
168 # wouldn't help us be correct in the face of re-entrancy either.
169
170 self.blocked_on = _blocking_on.setdefault(self.thread_id, _List())
171 self.blocked_on.append(self.lock)
172
173 def __exit__(self, *args, **kwargs):
174 """Remove self.lock from this thread's _blocking_on list."""

Callers

nothing calls this directly

Calls 3

_ListClass · 0.85
setdefaultMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected