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

Commitc1e5622

Browse files
committed
It was incorrect to callPyType_Ready on a type returned byPyType.tp_new. It should have not been allowed in the first place, but we accidentally clearedReady fromtp_flags. Instead, we will extendtp_flags and callPyType_Modified at the end of CLR MetaType.tp_new
1 parentea61b03 commitc1e5622

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