File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 11using System ;
2+ using System . Collections . Generic ;
23using NUnit . Framework ;
34using Python . Runtime ;
45using Python . Runtime . Platform ;
@@ -110,9 +111,15 @@ public static void PyCheck_Iter_PyObject_IsIterable_ThreadingLock_Test()
110111 // Create an instance of threading.Lock, which is one of the very few types that does not have the
111112 // TypeFlags.HaveIter set in Python 2. This tests a different code path in PyObject_IsIterable and PyIter_Check.
112113 var threading = Runtime . Runtime . PyImport_ImportModule ( "threading" ) ;
114+ Exceptions . ErrorCheck ( threading ) ;
113115 var threadingDict = Runtime . Runtime . PyModule_GetDict ( threading ) ;
116+ Exceptions . ErrorCheck ( threadingDict ) ;
114117 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+
115121 var lockInstance = Runtime . Runtime . PyObject_CallObject ( lockType , Runtime . Runtime . PyTuple_New ( 0 ) ) ;
122+ Exceptions . ErrorCheck ( lockInstance ) ;
116123
117124 Assert . IsFalse ( Runtime . Runtime . PyObject_IsIterable ( lockInstance ) ) ;
118125 Assert . IsFalse ( Runtime . Runtime . PyIter_Check ( lockInstance ) ) ;
You can’t perform that action at this time.
0 commit comments