Commit 28f869fd authored by Robert Bradshaw's avatar Robert Bradshaw

Don't require the GIL for the empty constructor.

parent 601f25ae
......@@ -1692,7 +1692,8 @@ class NewExprNode(AtomicExprNode):
self.cpp_check(env)
constructor = type.scope.lookup(u'<init>')
if constructor is None:
func_type = PyrexTypes.CFuncType(type, [], exception_check='+')
func_type = PyrexTypes.CFuncType(
type, [], exception_check='+', nogil=True)
type.scope.declare_cfunction(u'<init>', func_type, self.pos)
constructor = type.scope.lookup(u'<init>')
self.class_type = type
......
......@@ -143,3 +143,11 @@ def test_templates(long value):
assert base.get_value() == base.value == 2 * value, base.value
del base
cdef cppclass Simple:
pass
def test_default_init_no_gil():
with nogil:
s = new Simple()
del s
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