Skip to content

Commit

Permalink
Fix Python ScopedThreadEnvironment
Browse files Browse the repository at this point in the history
  • Loading branch information
dvicini committed Aug 12, 2024
1 parent 3fc8d54 commit 8bac8e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/python/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ MI_PY_EXPORT(Thread) {
D(ScopedSetThreadEnvironment))
.def(nb::init<const ThreadEnvironment &>())
.def("__enter__", &PyScopedSetThreadEnvironment::enter)
.def("__exit__", &PyScopedSetThreadEnvironment::exit);
.def("__exit__", &PyScopedSetThreadEnvironment::exit,
"exc_type"_a.none(), "exc_val"_a.none(), "exc_tb"_a.none());
}

7 changes: 7 additions & 0 deletions src/core/tests/test_thread.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import pytest
import mitsuba as mi

def test01_use_scoped_thread_environment(variant_scalar_rgb):
environment = mi.ThreadEnvironment()
with mi.ScopedSetThreadEnvironment(environment):
mi.Log(mi.LogLevel.Info, "Log from a thread environment.")

0 comments on commit 8bac8e9

Please sign in to comment.