Skip to content

Commit

Permalink
Fix without_gvl for exceptions occurred in a block
Browse files Browse the repository at this point in the history
Fixes GH-154
  • Loading branch information
mrkn committed Feb 10, 2022
1 parent 69cf4dd commit a6fea92
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ext/pycall/pycall.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ pycall_without_gvl(VALUE (* func)(VALUE), VALUE arg)

pycall_set_with_gvl();

if (state) {
rb_jump_tag(state);
}

return result;
}

Expand Down
10 changes: 10 additions & 0 deletions test/pycall/test-gvl.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class PyCallGvlTest < Test::Unit::TestCase
def test_exception
math = PyCall.import_module("math")
assert_raise_message(/factorial\(\) not defined for negative values/) do
PyCall.without_gvl do
math.factorial(-1)
end
end
end
end

0 comments on commit a6fea92

Please sign in to comment.