Skip to content

Commit

Permalink
fix where tp_getattro is set
Browse files Browse the repository at this point in the history
  • Loading branch information
eirannejad committed Mar 15, 2024
1 parent d91ceab commit 26b42be
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/runtime/Types/ReflectedClrType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ internal static NewReference CreateSubclass(ClassBase baseType, IEnumerable<Type
}

const BindingFlags tbFlags = BindingFlags.Public | BindingFlags.Static;

var tp_getattro_default = typeof(ReflectedClrType).GetMethod(nameof(ReflectedClrType.tp_getattro), tbFlags);
Util.WriteIntPtr(pyTypeObj, TypeOffset.tp_getattro, Interop.GetThunk(tp_getattro_default).Address);

using var clsDict = new PyDict(dict);
using var keys = clsDict.Keys();
foreach (PyObject pyKey in keys)
Expand All @@ -105,10 +109,6 @@ internal static NewReference CreateSubclass(ClassBase baseType, IEnumerable<Type
continue;
}

var tp_getattro_default = typeof(ReflectedClrType).GetMethod(nameof(ReflectedClrType.tp_getattro), tbFlags);
Util.WriteIntPtr(pyTypeObj, TypeOffset.tp_getattro, Interop.GetThunk(tp_getattro_default).Address);


if (keyStr.StartsWith(nameof(PyIdentifier.__getitem__)))
{
var mp_subscript = typeof(ReflectedClrType).GetMethod(nameof(ReflectedClrType.mp_subscript), tbFlags);
Expand Down

0 comments on commit 26b42be

Please sign in to comment.