Commit c951d4e2 authored by Stefan Behnel's avatar Stefan Behnel

avoid GIL error for optimised container bool tests that run in plain C

parent ff9c18d5
......@@ -6321,7 +6321,7 @@ class CoerceToBooleanNode(CoercionNode):
self.is_temp = 1
def nogil_check(self, env):
if self.arg.type.is_pyobject:
if self.arg.type.is_pyobject and self._special_builtins.get(self.arg.type) is None:
self.gil_error()
gil_message = "Truth-testing Python object"
......
......@@ -24,6 +24,23 @@ def if_list(list obj):
else:
return False
def if_list_nogil(list obj):
"""
>>> if_list_nogil( [] )
False
>>> if_list_nogil( [1] )
True
>>> if_list_nogil(None)
False
"""
cdef bint result
with nogil:
if obj:
result = True
else:
result = False
return result
def if_list_literal(t):
"""
>>> if_list_literal(True)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment