From e7c001bffe2a01afedcf1ce16f194563a1873948 Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Mon, 2 Apr 2018 09:30:46 +0900 Subject: [PATCH 1/2] bpo-33199: dict: Initialize ma_version_tag in PyDict_Copy --- Objects/dictobject.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Objects/dictobject.c b/Objects/dictobject.c index bb4ea1f5f9c522..be895d4c152425 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -2551,6 +2551,7 @@ PyDict_Copy(PyObject *o) split_copy->ma_values = newvalues; split_copy->ma_keys = mp->ma_keys; split_copy->ma_used = mp->ma_used; + split_copy->ma_version_tag = DICT_NEXT_VERSION(); DK_INCREF(mp->ma_keys); for (i = 0, n = size; i < n; i++) { PyObject *value = mp->ma_values[i]; From 24e2fecf19a94a941c87e22ad97cf26132b13240 Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Mon, 2 Apr 2018 09:32:44 +0900 Subject: [PATCH 2/2] Add NEWS entry --- .../Core and Builtins/2018-04-02-09-32-40.bpo-33199.TPnxQu.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2018-04-02-09-32-40.bpo-33199.TPnxQu.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2018-04-02-09-32-40.bpo-33199.TPnxQu.rst b/Misc/NEWS.d/next/Core and Builtins/2018-04-02-09-32-40.bpo-33199.TPnxQu.rst new file mode 100644 index 00000000000000..22abf8d000112a --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2018-04-02-09-32-40.bpo-33199.TPnxQu.rst @@ -0,0 +1,2 @@ +Fix ``ma_version_tag`` in dict implementation is uninitialized when copying +from key-sharing dict.