Skip to content

Commit dfeb354

Browse files
filmorlostmsu
authored andcommitted
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.
1 parent 216c705 commit dfeb354

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/runtime/typemanager.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ internal static PyType CreateMetatypeWithGCHandleOffset()
456456
int size = Util.ReadInt32(Runtime.PyTypeType, TypeOffset.tp_basicsize)
457457
+ IntPtr.Size // tp_clr_inst_offset
458458
;
459-
var result = new PyType(new TypeSpec("GC Offset Base", basicSize: size,
459+
var result = new PyType(new TypeSpec("clr._internal.GCOffsetBase", basicSize: size,
460460
new TypeSpec.Slot[]
461461
{
462462

@@ -480,7 +480,7 @@ internal static PyType CreateMetaType(Type impl, out SlotsHolder slotsHolder)
480480

481481
PyType gcOffsetBase = CreateMetatypeWithGCHandleOffset();
482482

483-
PyType type = AllocateTypeObject("CLR Metatype", metatype: gcOffsetBase);
483+
PyType type = AllocateTypeObject("CLRMetatype", metatype: gcOffsetBase);
484484

485485
Util.WriteRef(type, TypeOffset.tp_base, new NewReference(gcOffsetBase).Steal());
486486

@@ -509,7 +509,7 @@ internal static PyType CreateMetaType(Type impl, out SlotsHolder slotsHolder)
509509
}
510510

511511
BorrowedReference dict = Util.ReadRef(type, TypeOffset.tp_dict);
512-
using (var mod = Runtime.PyString_FromString("CLR"))
512+
using (var mod = Runtime.PyString_FromString("clr._internal"))
513513
Runtime.PyDict_SetItemString(dict, "__module__", mod.Borrow());
514514

515515
// The type has been modified after PyType_Ready has been called

tests/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def is_clr_root_module(ob):
2424

2525

2626
def is_clr_class(ob):
27-
return type(ob).__name__ == 'CLR Metatype' # for now
27+
return type(ob).__name__ == 'CLRMetatype' and type(ob).__module__ == 'clr._internal' # for now
2828

2929

3030
class ClassicClass:

0 commit comments

Comments
 (0)