Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b280b1b

Browse files
committed
Fixed bug related to converting number to a string
1 parent da146d9 commit b280b1b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/runtime/PythonTypes/PyInt.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ public BigInteger ToBigInteger()
228228
public string ToString(string format, IFormatProvider formatProvider)
229229
{
230230
using var _ = Py.GIL();
231-
return ToBigInteger().ToString(format, formatProvider);
231+
object val = Runtime.PyLong_AsLongLong(obj);
232+
return val?.ToString() ?? ToBigInteger().ToString(format, formatProvider);
232233
}
233234

234235
public override TypeCode GetTypeCode() => TypeCode.Int64;

0 commit comments

Comments
 (0)