Skip to content

Commit 00b55db

Browse files
committedSep 15, 2019
fix
1 parent 9fc5b5f commit 00b55db

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed
 

‎src/runtime/classbase.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,12 @@ public static IntPtr tp_str(IntPtr ob)
242242

243243
//First check which type in the object hierarchy provides ToString()
244244
//ToString has two "official" overloads so loop over GetMethods to get the one without parameters
245-
var method = type.GetMethod("ToString", new Type[]{});
246-
if (method.DeclaringTyppe != typeof(object))
245+
var instType = co.inst.GetType();
246+
var method = instType.GetMethod("ToString", new Type[]{});
247+
if (method.DeclaringType != typeof(object))
247248
{
248249
//match! something other than object provides a parameter-less overload of ToString
249-
return Runtime.Pystring_FromString(co.inst.ToString());
250+
return Runtime.PyString_FromString(co.inst.ToString());
250251
}
251252

252253
//If the object defines __repr__, call it.

0 commit comments

Comments
 (0)