diff --git a/src/runtime/interop.cs b/src/runtime/interop.cs
index e10348e39..641a188eb 100644
--- a/src/runtime/interop.cs
+++ b/src/runtime/interop.cs
@@ -4,7 +4,6 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Reflection;
-using System.Text;
namespace Python.Runtime
{
@@ -31,15 +30,6 @@ public string DocString
private string docStr;
}
- [Serializable]
- [AttributeUsage(AttributeTargets.Method | AttributeTargets.Delegate)]
- internal class PythonMethodAttribute : Attribute
- {
- public PythonMethodAttribute()
- {
- }
- }
-
[Serializable]
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Delegate)]
internal class ModuleFunctionAttribute : Attribute
diff --git a/src/runtime/typemanager.cs b/src/runtime/typemanager.cs
index 7a836bf05..cd4faae73 100644
--- a/src/runtime/typemanager.cs
+++ b/src/runtime/typemanager.cs
@@ -208,8 +208,6 @@ internal static unsafe PyType CreateType(Type impl)
Runtime.PyDict_SetItem(dict, PyIdentifier.__module__, mod);
mod.Dispose();
- InitMethods(dict, impl);
-
dict.Dispose();
// The type has been modified after PyType_Ready has been called
@@ -806,43 +804,6 @@ static void InitializeSlot(IntPtr type, int slotOffset, ThunkInfo thunk, SlotsHo
}
}
- ///
- /// Given a dict of a newly allocated Python type object and a managed Type that
- /// implements it, initialize any methods defined by the Type that need
- /// to appear in the Python type __dict__ (based on custom attribute).
- ///
- private static void InitMethods(BorrowedReference typeDict, Type type)
- {
- Type marker = typeof(PythonMethodAttribute);
-
- BindingFlags flags = BindingFlags.Public | BindingFlags.Static;
- var addedMethods = new HashSet();
-
- while (type != null)
- {
- MethodInfo[] methods = type.GetMethods(flags);
- foreach (MethodInfo method in methods)
- {
- if (!addedMethods.Contains(method.Name))
- {
- object[] attrs = method.GetCustomAttributes(marker, false);
- if (attrs.Length > 0)
- {
- string method_name = method.Name;
- var mi = new MethodInfo[1];
- mi[0] = method;
- MethodObject m = new TypeMethod(type, method_name, mi);
- Runtime.PyDict_SetItemString(typeDict, method_name, m.ObjectReference);
- m.DecrRefCount();
- addedMethods.Add(method_name);
- }
- }
- }
- type = type.BaseType;
- }
- }
-
-
///
/// Utility method to copy slots from a given type to another type.
///
diff --git a/src/runtime/typemethod.cs b/src/runtime/typemethod.cs
deleted file mode 100644
index 4da92613c..000000000
--- a/src/runtime/typemethod.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using System;
-using System.Reflection;
-
-namespace Python.Runtime
-{
- ///
- /// Implements a Python type that provides access to CLR object methods.
- ///
- internal class TypeMethod : MethodObject
- {
- public TypeMethod(Type type, string name, MethodInfo[] info) :
- base(type, name, info)
- {
- }
-
- public TypeMethod(Type type, string name, MethodInfo[] info, bool allow_threads) :
- base(type, name, info, allow_threads)
- {
- }
-
- public override IntPtr Invoke(IntPtr ob, IntPtr args, IntPtr kw)
- {
- MethodInfo mi = info[0];
- var arglist = new object[3];
- arglist[0] = ob;
- arglist[1] = args;
- arglist[2] = kw;
-
- try
- {
- object inst = null;
- if (ob != IntPtr.Zero)
- {
- inst = GetManagedObject(ob);
- }
- return (IntPtr)mi.Invoke(inst, BindingFlags.Default, null, arglist, null);
- }
- catch (Exception e)
- {
- Exceptions.SetError(e);
- return IntPtr.Zero;
- }
- }
- }
-}