| 373 | } |
| 374 | |
| 375 | PyObject* import_lichtfeld_module(const char* context, const bool latch_failure = false) { |
| 376 | if (g_python_bridge_failed.load(std::memory_order_acquire)) { |
| 377 | LOG_ERROR("{}: skipping lichtfeld import after previous initialization failure. Restart required. {}", |
| 378 | context, python_bridge_failure_detail()); |
| 379 | return nullptr; |
| 380 | } |
| 381 | |
| 382 | PyObject* lf = PyImport_ImportModule("lichtfeld"); |
| 383 | if (!lf) { |
| 384 | const std::string detail = consume_python_error_detailed(); |
| 385 | LOG_ERROR("{}: {}", context, detail); |
| 386 | if (latch_failure) { |
| 387 | remember_python_bridge_failure(detail); |
| 388 | } |
| 389 | return nullptr; |
| 390 | } |
| 391 | |
| 392 | return lf; |
| 393 | } |
| 394 | |
| 395 | bool ensure_builtin_ui_ready_locked() { |
| 396 | if (g_builtin_ui_ready.load(std::memory_order_acquire)) { |
no test coverage detected