File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 7
7
import pytest
8
8
import clr
9
9
import Python .Runtime
10
+ import threading
10
11
11
12
def test_pyobject_isiterable_on_list ():
12
13
"""Tests that Runtime.PyObject_IsIterable is true for lists ."""
@@ -31,3 +32,19 @@ def test_pyiter_check_on_listiterator():
31
32
ip = System .IntPtr .op_Explicit (System .Int64 (id (x )))
32
33
m = assy .GetType ("Python.Runtime.Runtime" ).GetMethod ("PyIter_Check" , System .Reflection .BindingFlags .NonPublic | System .Reflection .BindingFlags .Static )
33
34
assert m .Invoke (None , [ip ]) == True
35
+
36
+ def test_pyiter_check_on_threadlock ():
37
+ """Tests that Runtime.PyIter_Check is true for list iterators."""
38
+ assy = clr .AddReference ("Python.Runtime" )
39
+ x = threading .Lock ()
40
+ ip = System .IntPtr .op_Explicit (System .Int64 (id (x )))
41
+ m = assy .GetType ("Python.Runtime.Runtime" ).GetMethod ("PyIter_Check" , System .Reflection .BindingFlags .NonPublic | System .Reflection .BindingFlags .Static )
42
+ assert m .Invoke (None , [ip ]) == False
43
+
44
+ def test_pyobject_isiterable_on_threadlock ():
45
+ """Tests that Runtime.PyIter_Check is true for list iterators."""
46
+ assy = clr .AddReference ("Python.Runtime" )
47
+ x = threading .Lock ()
48
+ ip = System .IntPtr .op_Explicit (System .Int64 (id (x )))
49
+ m = assy .GetType ("Python.Runtime.Runtime" ).GetMethod ("PyObject_IsIterable" , System .Reflection .BindingFlags .NonPublic | System .Reflection .BindingFlags .Static )
50
+ assert m .Invoke (None , [ip ]) == False
You can’t perform that action at this time.
0 commit comments