From 38b0da1d954b62bca60ddf7c31b9e60372685f52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9drik=20Fuoco?= Date: Fri, 16 Jan 2026 09:09:56 -0500 Subject: [PATCH] Fix Windows debug with python debug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Cédrik Fuoco --- CMakeLists.txt | 2 +- .../opentimelineio-bindings/otio_utils.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc9981054..7d7e2ebbb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -187,7 +187,7 @@ if(WIN32) # Windows debug builds for Python require a d in order for the module to # load. This also helps ensure that debug builds in general are matched # to the Microsoft debug CRT. - set(OTIO_DEBUG_POSTFIX "d") + set(OTIO_DEBUG_POSTFIX "_d") endif() set_property(GLOBAL PROPERTY USE_FOLDERS ON) diff --git a/src/py-opentimelineio/opentimelineio-bindings/otio_utils.cpp b/src/py-opentimelineio/opentimelineio-bindings/otio_utils.cpp index 0403461e1..eaa74fc9f 100644 --- a/src/py-opentimelineio/opentimelineio-bindings/otio_utils.cpp +++ b/src/py-opentimelineio/opentimelineio-bindings/otio_utils.cpp @@ -98,10 +98,13 @@ void _build_any_to_py_dispatch_table() { } } -static py::object _value_to_any = py::none(); +// Initialized lazily after the interpreter is ready. +// constructing py::none() at static init time triggers +// pybind11 GIL assertions in Debug builds. +static py::object _value_to_any; static void py_to_any(py::object const& o, std::any* result) { - if (_value_to_any.is_none()) { + if (!_value_to_any || _value_to_any.is_none()) { py::object core = py::module::import("opentimelineio.core"); _value_to_any = core.attr("_value_to_any"); }