Skip to content

Commit f7cde02

Browse files
authored
Merge pull request #155 from mrkn/fix_without_gvl_for_exception
Fix without_gvl for exceptions occurred in a block
2 parents 69cf4dd + a6fea92 commit f7cde02

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

ext/pycall/pycall.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ pycall_without_gvl(VALUE (* func)(VALUE), VALUE arg)
107107

108108
pycall_set_with_gvl();
109109

110+
if (state) {
111+
rb_jump_tag(state);
112+
}
113+
110114
return result;
111115
}
112116

test/pycall/test-gvl.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class PyCallGvlTest < Test::Unit::TestCase
2+
def test_exception
3+
math = PyCall.import_module("math")
4+
assert_raise_message(/factorial\(\) not defined for negative values/) do
5+
PyCall.without_gvl do
6+
math.factorial(-1)
7+
end
8+
end
9+
end
10+
end

0 commit comments

Comments
 (0)