Skip to content

Commit

Permalink
Bitmap class: release GIL only after handling Python inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
dvicini authored and njroussel committed Apr 19, 2023
1 parent 0cf6701 commit 71556f9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/python/bitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,14 @@ MI_PY_EXPORT(Bitmap) {
bool srgb_gamma = b.srgb_gamma();
if (!srgb.is(py::none()))
srgb_gamma = srgb.cast<bool>();

py::gil_scoped_release release;
return b.convert(pixel_format, component_format, srgb_gamma,
alpha_transform);
},
D(Bitmap, convert),
"pixel_format"_a = py::none(), "component_format"_a = py::none(),
"srgb_gamma"_a = py::none(), "alpha_transform"_a = Bitmap::AlphaTransform::Empty,
py::call_guard<py::gil_scoped_release>())
"srgb_gamma"_a = py::none(), "alpha_transform"_a = Bitmap::AlphaTransform::Empty)
.def("convert", py::overload_cast<Bitmap *>(&Bitmap::convert, py::const_),
D(Bitmap, convert, 2), "target"_a,
py::call_guard<py::gil_scoped_release>())
Expand Down

0 comments on commit 71556f9

Please sign in to comment.