MCPcopy Create free account
hub / github.com/apache/arrow / SafeCallIntoPythonVoid

Function SafeCallIntoPythonVoid

python/pyarrow/src/arrow/python/common.h:168–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166
167template <typename Function>
168auto SafeCallIntoPythonVoid(Function&& func) -> decltype(func()) {
169 PyAcquireGIL lock;
170 PyObject* exc_type;
171 PyObject* exc_value;
172 PyObject* exc_traceback;
173 PyErr_Fetch(&exc_type, &exc_value, &exc_traceback);
174 func();
175 if (exc_type != NULLPTR) {
176 PyErr_Restore(exc_type, exc_value, exc_traceback);
177 }
178}
179
180// A RAII primitive that DECREFs the underlying PyObject* when it
181// goes out of scope.

Callers 1

BindFutureFunction · 0.85

Calls 1

funcFunction · 0.50

Tested by

no test coverage detected