diff --git a/src/runtime/extensiontype.cs b/src/runtime/extensiontype.cs
index 0ebd7ec4c..6d6d7a02f 100644
--- a/src/runtime/extensiontype.cs
+++ b/src/runtime/extensiontype.cs
@@ -87,18 +87,6 @@ public static int tp_setattro(IntPtr ob, IntPtr key, IntPtr val)
return -1;
}
-
- ///
- /// Default __set__ implementation - this prevents descriptor instances
- /// being silently replaced in a type __dict__ by default __setattr__.
- ///
- public static int tp_descr_set(IntPtr ds, IntPtr ob, IntPtr val)
- {
- Exceptions.SetError(Exceptions.AttributeError, "attribute is read-only");
- return -1;
- }
-
-
public static void tp_dealloc(IntPtr ob)
{
// Clean up a Python instance of this extension type. This
diff --git a/src/testing/methodtest.cs b/src/testing/methodtest.cs
index abdc5f4d6..9eae0e9f0 100644
--- a/src/testing/methodtest.cs
+++ b/src/testing/methodtest.cs
@@ -14,6 +14,8 @@ public MethodTest()
{
}
+ public string OverwritableMethod() => "overwritable";
+
public string PublicMethod()
{
return "public";
diff --git a/tests/test_method.py b/tests/test_method.py
index 9bdb571c0..4c5255fab 100644
--- a/tests/test_method.py
+++ b/tests/test_method.py
@@ -6,37 +6,12 @@
import pytest
from Python.Test import MethodTest
+def test_instance_method_overwritable():
+ """Test instance method overwriting."""
-def test_instance_method_descriptor():
- """Test instance method descriptor behavior."""
-
- with pytest.raises(AttributeError):
- MethodTest().PublicMethod = 0
-
- with pytest.raises(AttributeError):
- MethodTest.PublicMethod = 0
-
- with pytest.raises(AttributeError):
- del MethodTest().PublicMethod
-
- with pytest.raises(AttributeError):
- del MethodTest.PublicMethod
-
-
-def test_static_method_descriptor():
- """Test static method descriptor behavior."""
-
- with pytest.raises(AttributeError):
- MethodTest().PublicStaticMethod = 0
-
- with pytest.raises(AttributeError):
- MethodTest.PublicStaticMethod = 0
-
- with pytest.raises(AttributeError):
- del MethodTest().PublicStaticMethod
-
- with pytest.raises(AttributeError):
- del MethodTest.PublicStaticMethod
+ ob = MethodTest()
+ ob.OverwritableMethod = lambda: "overwritten"
+ assert ob.OverwritableMethod() == "overwritten"
def test_public_instance_method():
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