Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7deebd4

Browse files
committed
renamed parameter in tp_dealloc functions for clarity
1 parent 07f1657 commit 7deebd4

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/runtime/classbase.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,12 @@ public static NewReference tp_repr(BorrowedReference ob)
337337
/// <summary>
338338
/// Standard dealloc implementation for instances of reflected types.
339339
/// </summary>
340-
public static void tp_dealloc(NewReference ob)
340+
public static void tp_dealloc(NewReference lastRef)
341341
{
342-
ManagedType self = GetManagedObject(ob.Borrow())!;
343-
tp_clear(ob.Borrow());
344-
Runtime.PyObject_GC_UnTrack(ob.Borrow());
345-
Runtime.PyObject_GC_Del(ob.Steal());
342+
ManagedType self = GetManagedObject(lastRef.Borrow())!;
343+
tp_clear(lastRef.Borrow());
344+
Runtime.PyObject_GC_UnTrack(lastRef.Borrow());
345+
Runtime.PyObject_GC_Del(lastRef.Steal());
346346
self?.FreeGCHandle();
347347
}
348348

src/runtime/extensiontype.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ public static int tp_setattro(BorrowedReference ob, BorrowedReference key, Borro
8686
return -1;
8787
}
8888

89-
public static void tp_dealloc(NewReference ob)
89+
public static void tp_dealloc(NewReference lastRef)
9090
{
9191
// Clean up a Python instance of this extension type. This
9292
// frees the allocated Python object and decrefs the type.
93-
var self = (ExtensionType?)GetManagedObject(ob.Borrow());
93+
var self = (ExtensionType?)GetManagedObject(lastRef.Borrow());
9494
self?.Clear();
9595
self?.Dealloc();
9696
}

src/runtime/metatype.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -285,22 +285,22 @@ public static NewReference mp_subscript(BorrowedReference tp, BorrowedReference
285285
/// Dealloc implementation. This is called when a Python type generated
286286
/// by this metatype is no longer referenced from the Python runtime.
287287
/// </summary>
288-
public static void tp_dealloc(NewReference tp)
288+
public static void tp_dealloc(NewReference lastRef)
289289
{
290290
// Fix this when we dont cheat on the handle for subclasses!
291291

292-
var flags = (TypeFlags)Util.ReadCLong(tp.Borrow(), TypeOffset.tp_flags);
292+
var flags = (TypeFlags)Util.ReadCLong(lastRef.Borrow(), TypeOffset.tp_flags);
293293
if ((flags & TypeFlags.Subclass) == 0)
294294
{
295-
GetGCHandle(tp.Borrow()).Free();
295+
GetGCHandle(lastRef.Borrow()).Free();
296296
#if DEBUG
297297
// prevent ExecutionEngineException in debug builds in case we have a bug
298298
// this would allow using managed debugger to investigate the issue
299-
SetGCHandle(tp.Borrow(), Runtime.CLRMetaType, default);
299+
SetGCHandle(lastRef.Borrow(), Runtime.CLRMetaType, default);
300300
#endif
301301
}
302302

303-
var op = Util.ReadIntPtr(tp.Borrow(), TypeOffset.ob_type);
303+
var op = Util.ReadIntPtr(lastRef.Borrow(), TypeOffset.ob_type);
304304
// We must decref our type.
305305
// type_dealloc from PyType will use it to get tp_free so we must keep the value
306306
Runtime.XDecref(StolenReference.DangerousFromPointer(op));
@@ -311,7 +311,7 @@ public static void tp_dealloc(NewReference tp)
311311
// case our CLR metatype. That is why we implement tp_free.
312312

313313
IntPtr tp_dealloc = Util.ReadIntPtr(Runtime.PyTypeType, TypeOffset.tp_dealloc);
314-
NativeCall.CallDealloc(tp_dealloc, tp.Steal());
314+
NativeCall.CallDealloc(tp_dealloc, lastRef.Steal());
315315
}
316316

317317
private static NewReference DoInstanceCheck(BorrowedReference tp, BorrowedReference args, bool checkType)

0 commit comments

Comments
 (0)