Skip to content

Commit 52bdcb6

Browse files
committed
Fix use of CALL_WITH_GVL
1 parent da2c4eb commit 52bdcb6

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

ext/pycall/ruby_wrapper.c

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,11 @@ PyObject *
5959
PyRuby_New(VALUE ruby_object)
6060
{
6161
if (!ruby_thread_has_gvl_p()) {
62-
CALL_WITH_GVL(PyRuby_New_impl, ruby_object);
62+
return CALL_WITH_GVL(PyRuby_New_impl, ruby_object);
63+
}
64+
else {
65+
return PyRuby_New_impl(ruby_object);
6366
}
64-
65-
return PyRuby_New_impl(ruby_object);
6667
}
6768

6869
static void *
@@ -90,7 +91,9 @@ PyRuby_dealloc_with_gvl(PyRubyObject *pyro)
9091
if (!ruby_thread_has_gvl_p()) {
9192
CALL_WITH_GVL(PyRuby_dealloc, pyro);
9293
}
93-
PyRuby_dealloc(pyro);
94+
else {
95+
PyRuby_dealloc(pyro);
96+
}
9497
}
9598

9699
static PyObject *
@@ -114,7 +117,9 @@ PyRuby_repr_with_gvl(PyRubyObject *pyro)
114117
if (!ruby_thread_has_gvl_p()) {
115118
return CALL_WITH_GVL(PyRuby_repr, pyro);
116119
}
117-
return PyRuby_repr(pyro);
120+
else {
121+
return PyRuby_repr(pyro);
122+
}
118123
}
119124

120125
#if SIZEOF_SSIZE_T < 8
@@ -154,7 +159,9 @@ PyRuby_hash_long_with_gvl(PyRubyObject *pyro)
154159
if (!ruby_thread_has_gvl_p()) {
155160
return (long)(intptr_t)CALL_WITH_GVL(PyRuby_hash_long, pyro);
156161
}
157-
return (long)(intptr_t)PyRuby_hash_long(pyro);
162+
else {
163+
return (long)(intptr_t)PyRuby_hash_long(pyro);
164+
}
158165
}
159166

160167
static void *
@@ -185,7 +192,9 @@ PyRuby_hash_hash_t_with_gvl(PyRubyObject *pyro)
185192
if (!ruby_thread_has_gvl_p()) {
186193
return (Py_hash_t)CALL_WITH_GVL(PyRuby_hash_hash_t, pyro);
187194
}
188-
return (Py_hash_t)PyRuby_hash_hash_t(pyro);
195+
else {
196+
return (Py_hash_t)PyRuby_hash_hash_t(pyro);
197+
}
189198
}
190199

191200
struct call_rb_funcallv_params {
@@ -269,8 +278,9 @@ PyRuby_call_with_gvl(PyRubyObject *pyro, PyObject *pyobj_args, PyObject *pyobj_k
269278
if (!ruby_thread_has_gvl_p()) {
270279
return CALL_WITH_GVL(PyRuby_call, &params);
271280
}
272-
273-
return PyRuby_call(&params);
281+
else {
282+
return PyRuby_call(&params);
283+
}
274284
}
275285

276286
struct PyRuby_getattro_params {
@@ -348,8 +358,9 @@ PyRuby_getattro_with_gvl(PyRubyObject *pyro, PyObject *pyobj_name)
348358
if (!ruby_thread_has_gvl_p()) {
349359
return CALL_WITH_GVL(PyRuby_getattro, &params);
350360
}
351-
352-
return PyRuby_getattro(&params);
361+
else {
362+
return PyRuby_getattro(&params);
363+
}
353364
}
354365

355366
/* ==== PyCall::PyRubyPtr ==== */

0 commit comments

Comments
 (0)