Home | History | Annotate | Download | only in Lib

Lines Matching refs:cm

103         # CM must be recreated each time a decorated function is
307 # We use a list of old targets to make this CM re-entrant
375 def _create_exit_wrapper(cm, cm_exit):
377 return cm_exit(cm, exc_type, exc, tb)
416 def enter_context(self, cm):
424 _cm_type = type(cm)
426 result = _cm_type.__enter__(cm)
427 self._push_cm_exit(cm, _exit)
443 def _push_cm_exit(self, cm, cm_exit):
445 _exit_wrapper = self._create_exit_wrapper(cm, cm_exit)
446 _exit_wrapper.__self__ = cm
537 def _create_async_exit_wrapper(cm, cm_exit):
539 return await cm_exit(cm, exc_type, exc, tb)
548 async def enter_async_context(self, cm):
554 _cm_type = type(cm)
556 result = await _cm_type.__aenter__(cm)
557 self._push_async_cm_exit(cm, _exit)
595 def _push_async_cm_exit(self, cm, cm_exit):
598 _exit_wrapper = self._create_async_exit_wrapper(cm, cm_exit)
599 _exit_wrapper.__self__ = cm
665 cm = optional_cm if condition else nullcontext()
666 with cm: