mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-113157 gh-89519: Fix method descriptors (gh-113233)
Restore behaviors before classmethod descriptor chaining was introduced.
This commit is contained in:
parent
6a5b4736e5
commit
d058eaeed4
2 changed files with 23 additions and 0 deletions
|
@ -5004,6 +5004,21 @@ class ClassPropertiesAndMethods(unittest.TestCase):
|
|||
gc.collect()
|
||||
self.assertEqual(Parent.__subclasses__(), [])
|
||||
|
||||
def test_instance_method_get_behavior(self):
|
||||
# test case for gh-113157
|
||||
|
||||
class A:
|
||||
def meth(self):
|
||||
return self
|
||||
|
||||
class B:
|
||||
pass
|
||||
|
||||
a = A()
|
||||
b = B()
|
||||
b.meth = a.meth.__get__(b, B)
|
||||
self.assertEqual(b.meth(), a)
|
||||
|
||||
def test_attr_raise_through_property(self):
|
||||
# test case for gh-103272
|
||||
class A:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue