File tree 1 file changed +7
-0
lines changed
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 1
1
using System ;
2
+ using System . Collections . Generic ;
2
3
using NUnit . Framework ;
3
4
using Python . Runtime ;
4
5
using Python . Runtime . Platform ;
@@ -110,9 +111,15 @@ public static void PyCheck_Iter_PyObject_IsIterable_ThreadingLock_Test()
110
111
// Create an instance of threading.Lock, which is one of the very few types that does not have the
111
112
// TypeFlags.HaveIter set in Python 2. This tests a different code path in PyObject_IsIterable and PyIter_Check.
112
113
var threading = Runtime . Runtime . PyImport_ImportModule ( "threading" ) ;
114
+ Exceptions . ErrorCheck ( threading ) ;
113
115
var threadingDict = Runtime . Runtime . PyModule_GetDict ( threading ) ;
116
+ Exceptions . ErrorCheck ( threadingDict ) ;
114
117
var lockType = Runtime . Runtime . PyDict_GetItemString ( threadingDict , "Lock" ) ;
118
+ if ( lockType == IntPtr . Zero )
119
+ throw new KeyNotFoundException ( "class 'Lock' was not found in 'threading'" ) ;
120
+
115
121
var lockInstance = Runtime . Runtime . PyObject_CallObject ( lockType , Runtime . Runtime . PyTuple_New ( 0 ) ) ;
122
+ Exceptions . ErrorCheck ( lockInstance ) ;
116
123
117
124
Assert . IsFalse ( Runtime . Runtime . PyObject_IsIterable ( lockInstance ) ) ;
118
125
Assert . IsFalse ( Runtime . Runtime . PyIter_Check ( lockInstance ) ) ;
You can’t perform that action at this time.
0 commit comments