>("cache", out var _cache);
+ foreach (var entry in _cache)
{
- Type type = entry.Key;
+ if (!entry.Key.Valid)
+ {
+ Runtime.XDecref(entry.Value);
+ continue;
+ }
+ Type type = entry.Key.Value;;
IntPtr handle = entry.Value;
+ cache[type] = handle;
SlotsHolder holder = CreateSolotsHolder(handle);
InitializeSlots(handle, _slotsImpls[type], holder);
// FIXME: mp_length_slot.CanAssgin(clrType)
@@ -170,6 +177,10 @@ internal static IntPtr CreateType(Type impl)
Runtime.XDecref(mod);
InitMethods(type, impl);
+
+ // The type has been modified after PyType_Ready has been called
+ // Refresh the type
+ Runtime.PyType_Modified(type);
return type;
}
@@ -350,7 +361,7 @@ internal static IntPtr CreateSubType(IntPtr py_name, IntPtr py_base_type, IntPtr
try
{
Type subType = ClassDerivedObject.CreateDerivedType(name,
- baseClass.type,
+ baseClass.type.Value,
py_dict,
(string)namespaceStr,
(string)assembly);
@@ -459,6 +470,9 @@ internal static IntPtr CreateMetaType(Type impl, out SlotsHolder slotsHolder)
IntPtr mod = Runtime.PyString_FromString("CLR");
Runtime.PyDict_SetItemString(dict, "__module__", mod);
+ // The type has been modified after PyType_Ready has been called
+ // Refresh the type
+ Runtime.PyType_Modified(type);
//DebugUtil.DumpType(type);
return type;
@@ -560,6 +574,10 @@ internal static IntPtr BasicSubType(string name, IntPtr base_, Type impl)
IntPtr tp_dict = Marshal.ReadIntPtr(type, TypeOffset.tp_dict);
IntPtr mod = Runtime.PyString_FromString("CLR");
Runtime.PyDict_SetItem(tp_dict, PyIdentifier.__module__, mod);
+
+ // The type has been modified after PyType_Ready has been called
+ // Refresh the type
+ Runtime.PyType_Modified(type);
return type;
}
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