Skip to content

Conversation

@gfabiano
Copy link
Contributor

Added the support of py::call_guard<py::gil_scoped_release>() on generated def to fix some edge cases where the gil deadlock when calling a c++ function. In pybind and nanobind, there is the gil_scoped_release directive to handle this.

I implemented fn_add_gil_scoped_release_guard__regex to enable the call guards for the functions that needs that.

@gfabiano gfabiano changed the title Added gil_scoped_release support to functions using a regex ass acl Added gil_scoped_release support to functions using a regex as acl Nov 26, 2025
@pthom
Copy link
Owner

pthom commented Nov 26, 2025

Very nice, thanks!

Could you add a test inside src/litgen/tests/internal/adapted_types/adapted_function_test.py

Did you test it with pybind11 and nanobind? I looked at the doc, and saw that both seem to support this.

@gfabiano
Copy link
Contributor Author

Yes, I already considered nanobind. I added two tests to validate generation for both nanobind and pybind11.

@pthom pthom merged commit da191f8 into pthom:main Nov 27, 2025
@pthom
Copy link
Owner

pthom commented Nov 27, 2025

This was perfetto ! Thanks a lot.

@gfabiano
Copy link
Contributor Author

Sorry to bother you, but when I can expect a release on PyPI? this pull request derive from a issue I had and it will be good to only change version of litgen in my environment

@pthom
Copy link
Owner

pthom commented Nov 27, 2025

I just created a release (v0.22.0).

Out of curiosity, could you tell me more about how and where you are using litgen (I'm always interested to know how people are using my projects :-)

@gfabiano
Copy link
Contributor Author

Thank you!

Yes, briefly, in my company, we have to qualify our C++ software under SWE.6 (automotive). So we are developing a Python suite for that. We use litgen to generate bindings between the real software that exposes the API and the test suite in Python. Before, without litgen this part was made manually on each software we had to test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants