summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2023-01-12 22:13:56 (GMT)
committerGitHub <noreply@github.com>2023-01-12 22:13:56 (GMT)
commit94fc7706b7bc3d57cdd6d15bf8e8c4499ae53a69 (patch)
tree501e5fc7cea686172fe9a21102a232f1544f310c /Objects
parentb511d3512ba334475201baf4d9db7c4d28f0a9ad (diff)
downloadcpython-94fc7706b7bc3d57cdd6d15bf8e8c4499ae53a69.zip
cpython-94fc7706b7bc3d57cdd6d15bf8e8c4499ae53a69.tar.gz
cpython-94fc7706b7bc3d57cdd6d15bf8e8c4499ae53a69.tar.bz2
GH-100942: Fix incorrect cast in property_copy(). (#100965)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/descrobject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/descrobject.c b/Objects/descrobject.c
index c545b90..334be75 100644
--- a/Objects/descrobject.c
+++ b/Objects/descrobject.c
@@ -1712,7 +1712,9 @@ property_copy(PyObject *old, PyObject *get, PyObject *set, PyObject *del)
if (new == NULL)
return NULL;
- Py_XSETREF(((propertyobject *) new)->prop_name, Py_XNewRef(pold->prop_name));
+ if (PyObject_TypeCheck((new), &PyProperty_Type)) {
+ Py_XSETREF(((propertyobject *) new)->prop_name, Py_XNewRef(pold->prop_name));
+ }
return new;
}