Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit2108530

Browse files
committed
added debug message to the assert that fails on Mac to figure out the cause
1 parentd877337 commit2108530

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

‎src/runtime/classbase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,13 +387,13 @@ static int ClearImpl(IntPtr ob, ManagedType self)
387387
boolisTypeObject=Runtime.PyObject_TYPE(ob)==Runtime.PyCLRMetaType;
388388
if(!isTypeObject)
389389
{
390+
ClearObjectDict(ob);
391+
390392
intbaseClearResult=BaseUnmanagedClear(ob);
391393
if(baseClearResult!=0)
392394
{
393395
returnbaseClearResult;
394396
}
395-
396-
ClearObjectDict(ob);
397397
}
398398
if(selfis notnull)self.tpHandle=IntPtr.Zero;
399399
return0;

‎src/runtime/classderived.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,13 @@ internal ClassDerivedObject(Type tp) : base(tp)
7676
// So we don't call PyObject_GC_Del here and instead we set the python
7777
// reference to a weak reference so that the C# object can be collected.
7878
GCHandlegc=GCHandle.Alloc(self,GCHandleType.Weak);
79-
Debug.Assert(self.TypeReference==Runtime.PyObject_TYPE(self.ObjectReference));
79+
#ifDEBUG
80+
BorrowedReferenceinstanceType=Runtime.PyObject_TYPE(self.ObjectReference);
81+
if(self.TypeReference!=instanceType)
82+
{
83+
Debug.Fail($"{newPyObject(self.TypeReference)} vs{newPyObject(instanceType)}");
84+
}
85+
#endif
8086
SetGCHandle(self.ObjectReference,self.TypeReference,gc);
8187
self.gcHandle.Free();
8288
self.gcHandle=gc;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp