PyDocs

Nav

Python Runtime Services

ExitStack.enter_context

  • ExitStack.enter_context(cm)
Enters the supplied context manager.

If successful, also pushes its __exit__ method as a callback and
returns the result of the __enter__ method.
Changed in 3.11, 3.15
  • 3.11: Raises TypeError instead of AttributeError if cm is not a context manager.
  • 3.15: Added support for arbitrary descriptors __enter__() and __exit__().
0 Examples
No examples for contextlib/ExitStack.enter_context.
See Also
No see-alsos for contextlib/ExitStack.enter_context
0 Notes
No notes for ExitStack.enter_context