ContextGuard (Jython API documentation)
Date: 2024-08-18

org.python.core

## Class ContextGuard

- java.lang.Object
- - org.python.core.ContextGuard

- All Implemented Interfaces:
    ContextManager

      public class ContextGuard
      extends java.lang.Object
      implements ContextManager

  Straightens the call path for some common cases

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `PyObject` | `__enter__(ThreadState ts)`
    `boolean` | `__exit__(ThreadState ts, PyException exception)`
    `static ContextManager` | `getManager(PyObject manager)`
    `static PyObject` | `makeManager(PyObject object)`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### __enter__

          public PyObject __enter__(ThreadState ts)

      Specified by:
        `__enter__` in interface `ContextManager`

    - #### __exit__

          public boolean __exit__(ThreadState ts,
                                  PyException exception)

      Specified by:
        `__exit__` in interface `ContextManager`

    - #### getManager

          public static ContextManager getManager(PyObject manager)

    - #### makeManager

          public static PyObject makeManager(PyObject object)

Jython homepage