You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Multiple assertion failures for Python classes derived from System.Exception in debug builds #1218
Python type object for Sub class gets an unknown extra field of size IntPtr.Size, causing it to be larger than its base type object (reflected) System.Exception.
@amos402 not exactly sure what you mean. The reflected System.Exception should already have a slot for GCHandle. If that would be the reason, size of Sub would be equal to size of System.Exception, but it is not.
@lostmsu@amos402 I just took Amos's interop changes from the soft shutdown branch and applied them to master, and this issue goes away. I'll submit a PR soon with this change, even if it doesn't fix my PyType_FromSpec it could still make the soft shutdown branch easier to review without these changes
Activity
lostmsu commentedon Sep 11, 2020
It seems that the reason is that
System.Exceptionhas no weak list associated with it:amos402 commentedon Sep 11, 2020
Because it used tp_basicsize as the slot to save GCHandle, you can test it on soft-shutdown branch, it should be fine.
https://github.com/amos402/pythonnet/blob/12c0206b94173935864e0434ec22898753ffb6b5/src/runtime/interop.cs#L116-L117
I changed the slot.
lostmsu commentedon Sep 11, 2020
@amos402 not exactly sure what you mean. The reflected
System.Exceptionshould already have a slot forGCHandle. If that would be the reason, size ofSubwould be equal to size ofSystem.Exception, but it is not.amos402 commentedon Sep 11, 2020
Trust me, it fixed.
The reason is as I said. The size of
Subcome fromtype(System.Exception)->tp_basicsize, they're not equal.koubaa commentedon Sep 13, 2020
@lostmsu @amos402 I just took Amos's interop changes from the soft shutdown branch and applied them to master, and this issue goes away. I'll submit a PR soon with this change, even if it doesn't fix my PyType_FromSpec it could still make the soft shutdown branch easier to review without these changes
koubaa commentedon Oct 24, 2020
Fixed in master