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

Commit1391639

Browse files
authored
Merge pull request#1486 from losttech/bugs/PythonInheritsDotNet_DoubleTypeReady
Fixed double call to `PyType_Ready` in CLR MetaType's `tp_new`
2 parentsd300111 +c1e5622 commit1391639

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

‎src/runtime/metatype.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ public static IntPtr tp_new(IntPtr tp, IntPtr args, IntPtr kw)
145145
returnIntPtr.Zero;
146146
}
147147

148-
varflags=TypeFlags.Default;
148+
varflags=(TypeFlags)Util.ReadCLong(type,TypeOffset.tp_flags);
149+
if(!flags.HasFlag(TypeFlags.Ready))
150+
thrownewNotSupportedException("PyType.tp_new returned an incomplete type");
149151
flags|=TypeFlags.HasClrInstance;
150152
flags|=TypeFlags.HeapType;
151153
flags|=TypeFlags.BaseType;
@@ -170,8 +172,7 @@ public static IntPtr tp_new(IntPtr tp, IntPtr args, IntPtr kw)
170172
IntPtrgc=Marshal.ReadIntPtr(base_type,Offsets.tp_clr_inst);
171173
Marshal.WriteIntPtr(type,Offsets.tp_clr_inst,gc);
172174

173-
if(Runtime.PyType_Ready(type)!=0)
174-
throwPythonException.ThrowLastAsClrException();
175+
Runtime.PyType_Modified(newBorrowedReference(type));
175176

176177
returntype;
177178
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp