`IComparable` and `IEquatable` implementations by lostmsu · Pull Request #2322 · pythonnet/pythonnet
IComparable and IEquatable implementations for PyInt, PyFloat, and PyString for primitive .NET types
What does this implement/fix? Explain your changes.
Let's one do PyInt.CompareTo(42) and similar things
Does this close any currently open issues?
N/A
Any other comments?
Should we take GIL in these methods? Might be useful for Array.Sort when called from Python.
On a more general topic: should we have a way for Python to call a .NET method and have it not release the GIL for compatibility with 3rd party (to Python.NET) libraries that assume they can call back any methods they wish at any time. Because having explicit GIL acquisition in CompareTo to use with Array.Sort would kill performance. E.g. something like:
with clr.HoldGIL(): Array.Sort(dotnet_array_of_python_objects)
Checklist
Check all those that are applicable and complete.