@@ -79,6 +79,7 @@ bool IPyObjectDecoder.CanDecode(PyType objectType, Type targetType)
7979 return decodableTypes . IndexOf ( targetType ) >= 0 ;
8080 }
8181
82+ // converts a PyObject (list or tuple) to an ArrayList
8283 private static IList ConvertToArrayList ( PyObject pyObj )
8384 {
8485 using var pyList = PyList . AsList ( pyObj ) ;
@@ -93,6 +94,7 @@ private static IList ConvertToArrayList(PyObject pyObj)
9394 return result ;
9495 }
9596
97+ // converts a PyObject item to a CLR object
9698 private static object ConvertItem ( PyObject item )
9799 {
98100 if ( TryGetClrObject ( item , out var clrObject ) )
@@ -129,6 +131,7 @@ private static object ConvertItem(PyObject item)
129131 return item . AsManagedObject ( typeof ( object ) ) ;
130132 }
131133
134+ // safely asks a PyObject for its managed object
132135 private static bool TryGetClrObject ( PyObject pyObj , out object clrObject )
133136 {
134137 try
@@ -148,6 +151,7 @@ private static bool TryGetClrObject(PyObject pyObj, out object clrObject)
148151 }
149152 }
150153
154+ // convert each element for generic lists
151155 private static object ConvertGenericItem ( PyObject item , Type elementType )
152156 {
153157 if ( elementType == typeof ( object ) )
@@ -179,4 +183,4 @@ private static object ConvertGenericItem(PyObject item, Type elementType)
179183 return item . AsManagedObject ( elementType ) ;
180184 }
181185 }
182- }
186+ }
0 commit comments