- Notifications
You must be signed in to change notification settings - Fork750
apply amos interop changes from soft shutdown#1219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
ef44edd
to630da19
Comparesrc/runtime/interop.cs Outdated
private static int BaseOffset(IntPtr type) | ||
{ | ||
Debug.Assert(type != IntPtr.Zero); | ||
int typeSize = Marshal.ReadInt32(type, TypeOffset.tp_basicsize); | ||
Debug.Assert(typeSize > 0 && typeSize <= ExceptionOffset.Size()); | ||
Debug.Assert(typeSize > 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
IMHO, the assert should stay. This PR does not address it, but probably solves the problem@koubaa has.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
The checking oftypeSize <= ExceptionOffset.Size()
is totally a wrong idea, there's no connection between them. Why an other object size whould relates to an exception object size.
You can simply make it lager than that size by
classA(B,C,D,E,F,G):pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@amos402 if I remember correctly,BaseOffset
is only used for reflections of .NET classes created by Python.NET. Right now there are only two kinds of them:System.Exception
and everything derived from it, that end up deriving Python'sbuiltins.BaseException
orbuiltins.Exception
, and every other .NET type, which end up deriving frombuiltins.object
. Within those two categories each of the types has identical structure, and the ones derived fromException
just happen to be larger.
When Python class is inherited from a reflected .NET class via single inheritance, and has no extra low-level PyType stuff defined explicitly, I see no reason for its objects to be larger, than corresponding base class objects. Hence all such types should have either the same size as reflectedSystem.Object
or as reflectedSystem.Exception
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@koubaa I am fine with this PR without the check removal.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
codecov-commenter commentedSep 14, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Codecov Report
@@ Coverage Diff @@## master #1219 +/- ##======================================= Coverage 86.25% 86.25% ======================================= Files 1 1 Lines 291 291 ======================================= Hits 251 251 Misses 40 40
Flags with carried forward coverage won't be shown.Click here to find out more. Continue to review full report at Codecov.
|
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
fc8cdb7
to5ef0adf
Compare5ef0adf
to7f576cf
CompareUh oh!
There was an error while loading.Please reload this page.
@amos402@koubaa the fix is still incomplete. It places For example, on Windows x64 Python 3.8 an instance of PyType is 880 bytes long. An instance of pythonnet/src/runtime/metatype.cs Line 122 in022be19
Where it writes the To fix this it might be sufficient to increase |
amos402 commentedSep 24, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
It allocated the space, you can check |
Fixes#1218
Changes taken from@amos402 soft shutdown branch
CHANGELOG