From 41f176d31f7e8d8252724ea146d344d4b909b1b0 Mon Sep 17 00:00:00 2001 From: Benedikt Reinartz Date: Thu, 23 Dec 2021 23:59:12 +0100 Subject: [PATCH] Fix warning regarding undefined __module__ on GC Offset Base Also makes the type names a bit more Python-esque. The `clr._internal` module doesn't exist, but that is no difference to the previous setup. --- src/runtime/typemanager.cs | 6 +++--- tests/utils.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/runtime/typemanager.cs b/src/runtime/typemanager.cs index c0a835943..b6fea0ca1 100644 --- a/src/runtime/typemanager.cs +++ b/src/runtime/typemanager.cs @@ -456,7 +456,7 @@ internal static PyType CreateMetatypeWithGCHandleOffset() int size = Util.ReadInt32(Runtime.PyTypeType, TypeOffset.tp_basicsize) + IntPtr.Size // tp_clr_inst_offset ; - var result = new PyType(new TypeSpec("GC Offset Base", basicSize: size, + var result = new PyType(new TypeSpec("clr._internal.GCOffsetBase", basicSize: size, new TypeSpec.Slot[] { @@ -480,7 +480,7 @@ internal static PyType CreateMetaType(Type impl, out SlotsHolder slotsHolder) PyType gcOffsetBase = CreateMetatypeWithGCHandleOffset(); - PyType type = AllocateTypeObject("CLR Metatype", metatype: gcOffsetBase); + PyType type = AllocateTypeObject("CLRMetatype", metatype: gcOffsetBase); Util.WriteRef(type, TypeOffset.tp_base, new NewReference(gcOffsetBase).Steal()); @@ -509,7 +509,7 @@ internal static PyType CreateMetaType(Type impl, out SlotsHolder slotsHolder) } BorrowedReference dict = Util.ReadRef(type, TypeOffset.tp_dict); - using (var mod = Runtime.PyString_FromString("CLR")) + using (var mod = Runtime.PyString_FromString("clr._internal")) Runtime.PyDict_SetItemString(dict, "__module__", mod.Borrow()); // The type has been modified after PyType_Ready has been called diff --git a/tests/utils.py b/tests/utils.py index b467cae97..6246d12ac 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -24,7 +24,7 @@ def is_clr_root_module(ob): def is_clr_class(ob): - return type(ob).__name__ == 'CLR Metatype' # for now + return type(ob).__name__ == 'CLRMetatype' and type(ob).__module__ == 'clr._internal' # for now class ClassicClass: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

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