PyObject.GetHashCode() can throw an OverflowException because IntPtr.ToInt32() does throw. See
pythonnet/src/runtime/pyobject.cs
Line 912 in b8cb6c4
var ulongVal = (ulong)ptr; return (int)((uint)ulongVal ^ (uint)(ulongVal >> 32));
This happened to me when inserting into a dictionary using tensorflow objects as keys:
new Dictionary<dynamic, dynamic>() { { x, 1.0 }, { y, 1.0 }, }
Yes, please, can you prepare a PR for this?
I don't have the project set up. I can submit a blind untested PR if that helps.
Sure, go ahead. It's anyways tricky to write tests for this as you need both a 64bit system and reliably force allocation above 2^32 for this patch to make a difference.
The PR is there. Some build stuff failed. I have no idea what it means. I compiled and ran tests locally.
Activity
filmor commented on May 26, 2018
Yes, please, can you prepare a PR for this?
GSPP commented on May 26, 2018
I don't have the project set up. I can submit a blind untested PR if that helps.
filmor commented on May 26, 2018
Sure, go ahead. It's anyways tricky to write tests for this as you need both a 64bit system and reliably force allocation above 2^32 for this patch to make a difference.
GSPP commented on May 27, 2018
The PR is there. Some build stuff failed. I have no idea what it means. I compiled and ran tests locally.