| 3519 | } |
| 3520 | |
| 3521 | PyObject* GetPyEagerContext() { |
| 3522 | if (weak_eager_context == nullptr) { |
| 3523 | PyErr_SetString(PyExc_RuntimeError, "Python eager context is not set"); |
| 3524 | return nullptr; |
| 3525 | } |
| 3526 | PyObject* py_context = PyWeakref_GET_OBJECT(weak_eager_context); |
| 3527 | if (py_context == Py_None) { |
| 3528 | PyErr_SetString(PyExc_RuntimeError, "Eager context has been destroyed"); |
| 3529 | return nullptr; |
| 3530 | } |
| 3531 | Py_INCREF(py_context); |
| 3532 | return py_context; |
| 3533 | } |
no outgoing calls
no test coverage detected