Commit 5008e863 authored by Mark Florisson's avatar Mark Florisson

Issue errors for nogil buffer acquisition

parent eee370b0
...@@ -1807,8 +1807,14 @@ class CFuncDefNode(FuncDefNode): ...@@ -1807,8 +1807,14 @@ class CFuncDefNode(FuncDefNode):
formal_arg.type = type_arg.type formal_arg.type = type_arg.type
formal_arg.name = type_arg.name formal_arg.name = type_arg.name
formal_arg.cname = type_arg.cname formal_arg.cname = type_arg.cname
if type_arg.type.is_buffer and 'inline' in self.modifiers: if type_arg.type.is_buffer:
if self.type.nogil:
error(formal_arg.pos,
"Buffer may not be acquired without the GIL. "
"Consider using memoryview slices instead.")
elif 'inline' in self.modifiers:
warning(formal_arg.pos, "Buffer unpacking not optimized away.", 1) warning(formal_arg.pos, "Buffer unpacking not optimized away.", 1)
name = name_declarator.name name = name_declarator.name
cname = name_declarator.cname cname = name_declarator.cname
self.entry = env.declare_cfunction( self.entry = env.declare_cfunction(
......
# mode: error
cimport numpy as np
cdef void func(np.ndarray[np.double_t, ndim=1] myarray) nogil:
pass
_ERRORS = u"""
5:15: Buffer may not be acquired without the GIL. Consider using memoryview slices instead.
"""
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