diff options
author | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2023-01-12 22:13:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-12 22:13:56 (GMT) |
commit | 94fc7706b7bc3d57cdd6d15bf8e8c4499ae53a69 (patch) | |
tree | 501e5fc7cea686172fe9a21102a232f1544f310c /Lib/test/test_property.py | |
parent | b511d3512ba334475201baf4d9db7c4d28f0a9ad (diff) | |
download | cpython-94fc7706b7bc3d57cdd6d15bf8e8c4499ae53a69.zip cpython-94fc7706b7bc3d57cdd6d15bf8e8c4499ae53a69.tar.gz cpython-94fc7706b7bc3d57cdd6d15bf8e8c4499ae53a69.tar.bz2 |
GH-100942: Fix incorrect cast in property_copy(). (#100965)
Diffstat (limited to 'Lib/test/test_property.py')
-rw-r--r-- | Lib/test/test_property.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_property.py b/Lib/test/test_property.py index d07b863..d4bdf50 100644 --- a/Lib/test/test_property.py +++ b/Lib/test/test_property.py @@ -214,6 +214,23 @@ class PropertyTests(unittest.TestCase): ): p.__set_name__(*([0] * i)) + def test_property_setname_on_property_subclass(self): + # https://github.com/python/cpython/issues/100942 + # Copy was setting the name field without first + # verifying that the copy was an actual property + # instance. As a result, the code below was + # causing a segfault. + + class pro(property): + def __new__(typ, *args, **kwargs): + return "abcdef" + + class A: + pass + + p = property.__new__(pro) + p.__set_name__(A, 1) + np = p.getter(lambda self: 1) # Issue 5890: subclasses of property do not preserve method __doc__ strings class PropertySub(property): |