Skip to content

Commit d69fcb1

Browse files
Fix crash on exit with a debug Python (#2866)
Under the hood (in both before and after code), this statement is adding the Exception instance as an attribute to the module. Other examples found using the pattern, suggesting the static variable scope was not needed: - py::register_exception<mx::ExceptionOrphanedElement>(mod, "ExceptionOrphanedElement"); - py::register_exception<mx::ExceptionFoundCycle>(mod, "ExceptionFoundCycle"); - py::register_exception<mx::ExceptionParseError>(mod, "ExceptionParseError"); - py::register_exception<mx::ExceptionFileMissing>(mod, "ExceptionFileMissing"); Fixes #2749
1 parent c1ea70b commit d69fcb1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

source/PyMaterialX/PyMaterialXCore/PyException.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace mx = MaterialX;
1212

1313
void bindPyException(py::module& mod)
1414
{
15-
static py::exception<mx::Exception> pyException(mod, "Exception");
15+
py::register_exception<mx::Exception>(mod, "Exception");
1616

1717
py::register_exception_translator(
1818
[](std::exception_ptr errPtr)

0 commit comments

Comments
 (0)