File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -296,6 +296,31 @@ public void IterableDecoderTest()
296
296
Assert . DoesNotThrow ( ( ) => { codec . TryDecode ( pyList , out intEnumerable ) ; } ) ;
297
297
CollectionAssert . AreEqual ( intEnumerable , new List < object > { 1 , 2 , 3 } ) ;
298
298
}
299
+
300
+ // regression for https://github.com/pythonnet/pythonnet/issues/1427
301
+ [ Test ]
302
+ public void PythonRegisteredDecoder_NoStackOverflowOnSystemType ( )
303
+ {
304
+ const string PyCode = @"
305
+ import clr
306
+ import System
307
+ from Python.Runtime import PyObjectConversions
308
+ from Python.Runtime.Codecs import RawProxyEncoder
309
+
310
+
311
+ class ListAsRawEncoder(RawProxyEncoder):
312
+ __namespace__ = 'Dummy'
313
+ def CanEncode(self, clr_type):
314
+ return clr_type.Name == 'IList`1' and clr_type.Namespace == 'System.Collections.Generic'
315
+
316
+
317
+ list_encoder = ListAsRawEncoder()
318
+ PyObjectConversions.RegisterEncoder(list_encoder)
319
+
320
+ system_type = list_encoder.GetType()" ;
321
+
322
+ PythonEngine . Exec ( PyCode ) ;
323
+ }
299
324
}
300
325
301
326
/// <summary>
You can’t perform that action at this time.
0 commit comments