Loading...
Searching...
No Matches
NbGuard.h
Go to the documentation of this file.
1/*
2** Interpreter init without pybind11.
3**
4** Polarity:
5** * Preferred: Python owns the process (eon-server + pyeonclient).
6*Interpreter
7** already exists; ensure_interpreter() is a no-op.
8** * Fallback: standalone eonclient needs a pot that calls into Python (ASE).
9** Use Py_InitializeEx — do NOT depend on pybind11::embed.
10**
11** Object/array marshalling for pots should use nanobind (nb::object,
12*nb::ndarray)
13** once the interpreter is up, matching pyeonclient.
14*/
15#pragma once
16
17#include <Python.h>
18
19namespace eonc {
20
21inline void ensure_interpreter() {
22 if (!Py_IsInitialized()) {
23 // 0 = skip signal handlers (same idea as pybind11 embed defaults)
24 Py_InitializeEx(0);
25 }
26}
27
28} // namespace eonc
RAII resource manager for the ARTn C library with global synchronization.
void ensure_interpreter()
Definition NbGuard.h:21