Commit 3d2eaa78 authored by Xavier Thompson's avatar Xavier Thompson

Adapt unit test for cypclass lock errors

parent 84ea02c8
...@@ -9,35 +9,18 @@ cdef cypclass A checklock: ...@@ -9,35 +9,18 @@ cdef cypclass A checklock:
void setter(self, int a): void setter(self, int a):
self.a = a self.a = a
cdef void take_write_locked(A obj):
pass
cdef int take_read_locked(const A obj):
return 3
def incorrect_locks(): def incorrect_locks():
obj = A() obj = A()
obj.a = 3 obj.a = 3
obj.getter() obj.getter()
with rlocked obj: with rlocked obj:
obj.setter(42) obj.setter(42)
take_write_locked(obj) return obj.a
obj.a
take_read_locked(obj)
cdef A global_cyobject
cdef void global_lock_taking():
with wlocked global_cyobject:
global_cyobject.setter(global_cyobject.getter() + 1)
_ERRORS = u""" _ERRORS = u"""
20:4: Reference 'obj' is not correctly locked in this expression (write lock required) 8:15: Reference 'self' is not correctly locked in this expression (read lock required)
21:4: Reference 'obj' is not correctly locked in this expression (read lock required) 10:8: Reference 'self' is not correctly locked in this expression (write lock required)
23:8: Reference 'obj' is not correctly locked in this expression (write lock required) 14:4: Reference 'obj' is not correctly locked in this expression (write lock required)
24:26: Reference 'obj' is not correctly locked in this expression (write lock required) 18:11: Reference 'obj' is not correctly locked in this expression (read lock required)
25:4: Reference 'obj' is not correctly locked in this expression (read lock required)
26:21: Reference 'obj' is not correctly locked in this expression (read lock required)
32:17: Can only lock local variables or arguments
""" """
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