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

Commitf48d7a9

Browse files
committed
ClassGeneric.GetClass now returns BorrowedReference to indicate that the value should not be disposed
1 parentcf8823f commitf48d7a9

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

‎src/runtime/ClassManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ internal static void RestoreRuntimeData(ClassManagerState storage)
133133
/// Return the ClassBase-derived instance that implements a particular
134134
/// reflected managed type, creating it if it doesn't yet exist.
135135
/// </summary>
136-
internalstaticReflectedClrTypeGetClass(Typetype)=>ReflectedClrType.GetOrCreate(type);
136+
internalstaticBorrowedReferenceGetClass(Typetype)=>ReflectedClrType.GetOrCreate(type);
137137

138138
internalstaticClassBaseGetClassImpl(Typetype)
139139
{

‎src/runtime/Types/ClassObject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public override NewReference type_subscript(BorrowedReference idx)
236236
returnExceptions.RaiseTypeError("type expected");
237237
}
238238
Typea=t.MakeArrayType();
239-
PyTypeo=ClassManager.GetClass(a);
239+
BorrowedReferenceo=ClassManager.GetClass(a);
240240
returnnewNewReference(o);
241241
}
242242

‎src/runtime/Types/ClrObject.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ internal static NewReference GetReference(object ob, BorrowedReference pyType)
4343

4444
internalstaticNewReferenceGetReference(objectob,Typetype)
4545
{
46-
PyTypecc=ClassManager.GetClass(type);
46+
BorrowedReferencecc=ClassManager.GetClass(type);
4747
returnCreate(ob,cc);
4848
}
4949

5050
internalstaticNewReferenceGetReference(objectob)
5151
{
52-
PyTypecc=ClassManager.GetClass(ob.GetType());
52+
BorrowedReferencecc=ClassManager.GetClass(ob.GetType());
5353
returnCreate(ob,cc);
5454
}
5555

‎src/runtime/Types/MethodObject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public static NewReference tp_descr_get(BorrowedReference ds, BorrowedReference
191191
&&obj.instisIPythonDerivedType
192192
&&self.type.Value.IsInstanceOfType(obj.inst))
193193
{
194-
varbasecls=ClassManager.GetClass(self.type.Value);
194+
varbasecls=ReflectedClrType.GetOrCreate(self.type.Value);
195195
returnnewMethodBinding(self,newPyObject(ob),basecls).Alloc();
196196
}
197197

‎src/runtime/Types/ReflectedClrType.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ internal sealed class ReflectedClrType : PyType
1212
{
1313
privateReflectedClrType(StolenReferencereference):base(reference,prevalidated:true){}
1414
internalReflectedClrType(ReflectedClrTypeoriginal):base(original,prevalidated:true){}
15+
internalReflectedClrType(BorrowedReferenceoriginal):base(original){}
1516
ReflectedClrType(SerializationInfoinfo,StreamingContextcontext):base(info,context){}
1617

1718
internalClassBaseImpl=>(ClassBase)ManagedType.GetManagedObject(this)!;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp