@@ -71,7 +71,7 @@ public void TupleRoundtripObject()
71
71
static void TupleRoundtripObject < T , TTuple > ( )
72
72
{
73
73
var tuple = Activator . CreateInstance ( typeof ( T ) , 42.0 , "42" , new object ( ) ) ;
74
- using var pyTuple = TupleCodec < TTuple > . Instance . TryEncode ( tuple ) ;
74
+ using var pyTuple = TupleCodec < TTuple > . Instance . TryEncode ( tuple , typeof ( T ) ) ;
75
75
Assert . IsTrue ( TupleCodec < TTuple > . Instance . TryDecode ( pyTuple , out object restored ) ) ;
76
76
Assert . AreEqual ( expected : tuple , actual : restored ) ;
77
77
}
@@ -85,7 +85,7 @@ public void TupleRoundtripGeneric()
85
85
static void TupleRoundtripGeneric < T , TTuple > ( )
86
86
{
87
87
var tuple = Activator . CreateInstance ( typeof ( T ) , 42 , "42" , new object ( ) ) ;
88
- using var pyTuple = TupleCodec < TTuple > . Instance . TryEncode ( tuple ) ;
88
+ using var pyTuple = TupleCodec < TTuple > . Instance . TryEncode ( tuple , typeof ( T ) ) ;
89
89
Assert . IsTrue ( TupleCodec < TTuple > . Instance . TryDecode ( pyTuple , out T restored ) ) ;
90
90
Assert . AreEqual ( expected : tuple , actual : restored ) ;
91
91
}
@@ -438,7 +438,7 @@ public bool TryDecode<T>(PyObject pyObj, out T value)
438
438
return true ;
439
439
}
440
440
441
- public PyObject TryEncode ( object value )
441
+ public PyObject TryEncode ( object value , Type type )
442
442
{
443
443
var error = ( ValueErrorWrapper ) value ;
444
444
return PythonEngine . Eval ( "ValueError" ) . Invoke ( error . Message . ToPython ( ) ) ;
@@ -478,7 +478,7 @@ public bool TryDecode<T>(PyObject pyObj, out T value)
478
478
class ObjectToEncoderInstanceEncoder < T > : IPyObjectEncoder
479
479
{
480
480
public bool CanEncode ( Type type ) => type == typeof ( T ) ;
481
- public PyObject TryEncode ( object value ) => PyObject . FromManagedObject ( this ) ;
481
+ public PyObject TryEncode ( object value , Type type ) => PyObject . FromManagedObject ( this ) ;
482
482
}
483
483
484
484
/// <summary>
0 commit comments