pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/pythonnet/pythonnet/commit/8668579834623a1ef196840b8f2a93407f52701b

bd07e.css" /> Define slots before initialization · pythonnet/pythonnet@8668579 · GitHub
Skip to content

Commit 8668579

Browse files
committed
Define slots before initialization
1 parent 5636262 commit 8668579

2 files changed

Lines changed: 14 additions & 10 deletions

File tree

src/runtime/PythonTypes/PyType.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ private static StolenReference FromSpec(TypeSpec spec, PyTuple? bases = null)
155155
using var nativeSpec = new NativeTypeSpec(spec);
156156
var basesRef = bases is null ? default : bases.Reference;
157157
var result = Runtime.PyType_FromSpecWithBases(in nativeSpec, basesRef);
158+
// Runtime.PyErr_Print();
158159
return result.StealOrThrow();
159160
}
160161
}

src/runtime/TypeManager.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -475,17 +475,20 @@ internal static PyType CreateMetatypeWithGCHandleOffset()
475475
int size = Util.ReadInt32(Runtime.PyTypeType, TypeOffset.tp_basicsize)
476476
+ IntPtr.Size // tp_clr_inst_offset
477477
;
478-
var result = new PyType(new TypeSpec("clr._internal.GCOffsetBase", basicSize: size,
479-
new TypeSpec.Slot[]
480-
{
481-
482-
},
483-
TypeFlags.Default | TypeFlags.HeapType | TypeFlags.HaveGC),
484-
bases: new PyTuple(new[] { py_type }));
485478

486-
SetRequiredSlots(result, seen: new HashSet<string>());
487-
488-
Runtime.PyType_Modified(result);
479+
var slots = new[] {
480+
new TypeSpec.Slot(TypeSlotID.tp_traverse, subtype_traverse),
481+
new TypeSpec.Slot(TypeSlotID.tp_clear, subtype_clear)
482+
};
483+
var result = new PyType(
484+
new TypeSpec(
485+
"clr._internal.GCOffsetBase",
486+
basicSize: size,
487+
slots: slots,
488+
TypeFlags.Default | TypeFlags.HeapType | TypeFlags.HaveGC
489+
),
490+
bases: new PyTuple(new[] { py_type })
491+
);
489492

490493
return result;
491494
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy