Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,4 @@
- ([@alxnull](https://github.com/alxnull))
- ([@gpetrou](https://github.com/gpetrou))
- Ehsan Iran-Nejad ([@eirannejad](https://github.com/eirannejad))
- Rolf Madsen ([@rmadsen-ks](https://github.com/rmadsen-ks))
1 change: 1 addition & 0 deletions 1 src/python_tests_runner/PythonTestRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ static IEnumerable<string[]> PythonTestCases()
// Add the test that you want to debug here.
yield return new[] { "test_indexer", "test_boolean_indexer" };
yield return new[] { "test_delegate", "test_bool_delegate" };
yield return new[] { "test_conversion", "test_object_string_format" };
}

/// <summary>
Expand Down
3 changes: 2 additions & 1 deletion 3 src/runtime/PythonTypes/PyInt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ public BigInteger ToBigInteger()
public string ToString(string format, IFormatProvider formatProvider)
{
using var _ = Py.GIL();
return ToBigInteger().ToString(format, formatProvider);
object val = Runtime.PyLong_AsLongLong(obj);
return val?.ToString() ?? ToBigInteger().ToString(format, formatProvider);
}

public override TypeCode GetTypeCode() => TypeCode.Int64;
Expand Down
6 changes: 6 additions & 0 deletions 6 tests/test_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,3 +752,9 @@ def test_explicit_conversion():
assert int(t(123.4)) == 123
with pytest.raises(TypeError):
index(t(123.4))

def test_object_string_format():
from System import String
integer_value = 200
string_value = String.Format("{0}", integer_value)
assert string_value == "200", f"{string_value} != ""200"""
3 changes: 3 additions & 0 deletions 3 tests/test_delegate.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,3 +451,6 @@ def wrong_return_type(intValue, stringValue):
# test sig mismatch, both on managed and Python side

# test return wrong type



Morty Proxy This is a proxified and sanitized view of the page, visit original site.