Skip to content

Free GIL when running check_bytes_arrays_within_dist - #27

Closed
mrecachinas wants to merge 2 commits into
masterfrom
fix-gil
Closed

Free GIL when running check_bytes_arrays_within_dist#27
mrecachinas wants to merge 2 commits into
masterfrom
fix-gil

Conversation

@mrecachinas

@mrecachinas mrecachinas commented Nov 30, 2024

Copy link
Copy Markdown
Owner

Fixes #23

Add GIL release in check_bytes_arrays_within_dist function.

  • Add Py_BEGIN_ALLOW_THREADS macro before the loop in check_bytes_arrays_within_dist_wrapper function in hexhamming/python_hexhamming.cc.
  • Add Py_END_ALLOW_THREADS macro after the loop in check_bytes_arrays_within_dist_wrapper function in hexhamming/python_hexhamming.cc.
  • Remove the in-loop return statement in check_bytes_arrays_within_dist_wrapper function in hexhamming/python_hexhamming.cc.
  • Add unit test test_check_bytes_arrays_within_dist_gil in test/test_hexhamming.py to verify the functionality of check_bytes_arrays_within_dist function with GIL released.

Fixes #23

Add GIL release in `check_bytes_arrays_within_dist` function.

- Add `Py_BEGIN_ALLOW_THREADS` macro before the loop in `check_bytes_arrays_within_dist_wrapper` function in `hexhamming/python_hexhamming.cc`.
- Add `Py_END_ALLOW_THREADS` macro after the loop in `check_bytes_arrays_within_dist_wrapper` function in `hexhamming/python_hexhamming.cc`.
- Remove the in-loop return statement in `check_bytes_arrays_within_dist_wrapper` function in `hexhamming/python_hexhamming.cc`.
- Add unit test `test_check_bytes_arrays_within_dist_gil` in `test/test_hexhamming.py` to verify the functionality of `check_bytes_arrays_within_dist` function with GIL released.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/mrecachinas/hexhamming/issues/23?shareId=XXXX-XXXX-XXXX-XXXX).
@mrecachinas
mrecachinas requested a review from Copilot November 30, 2024 15:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 suggestion.

Files not reviewed (1)
  • hexhamming/python_hexhamming.cc: Language not supported

Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more

Comment thread test/test_hexhamming.py Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mrecachinas
mrecachinas deleted the fix-gil branch February 16, 2026 20:59
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.

Free GIL when running check_bytes_arrays_within_dist

2 participants