if self.is_used_as_rvalue:
entry = self.entry
if entry.is_builtin:
- # if not Options.cache_builtins: # cached builtins are ok
- self.gil_error()
+ if not Options.cache_builtins: # cached builtins are ok
+ self.gil_error()
elif entry.is_pyglobal:
self.gil_error()
self.expr.analyse_expressions(env)
def nogil_check(self, env):
- if self.expr.type.is_pyobject:
+ if self.expr.type.is_pyobject and self.expr.is_temp:
self.gil_error()
gil_message = "Discarding owned Python object"
for obj from 0 <= obj < 4:
pass
+def bare_pyvar_name(object x):
+ with nogil:
+ x
+
# For m(), the important thing is that there are errors on all lines in the range 23-69
-# except these: 34, 44, 56, 58, 60, 62-64
+# except these: 29, 34, 44, 56, 58, 60, 62-64
_ERRORS = u"""
1:5: Function with Python return type cannot be declared nogil
26:12: Assignment of Python object not allowed without gil
28:8: Discarding owned Python object not allowed without gil
28:16: Constructing complex number not allowed without gil
-29:12: Accessing Python global or builtin not allowed without gil
-29:12: Discarding owned Python object not allowed without gil
30:8: Backquote expression not allowed without gil
30:8: Discarding owned Python object not allowed without gil
30:9: Operation not allowed without gil