]> granicus.if.org Git - python/commitdiff
bpo-33199: Initialize ma_version_tag in PyDict_Copy (GH-6341)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 3 Apr 2018 03:22:14 +0000 (20:22 -0700)
committerGitHub <noreply@github.com>
Tue, 3 Apr 2018 03:22:14 +0000 (20:22 -0700)
(cherry picked from commit d1c82c5cc7be0c21dddf86fd19c1702f6218459b)

Co-authored-by: INADA Naoki <methane@users.noreply.github.com>
Misc/NEWS.d/next/Core and Builtins/2018-04-02-09-32-40.bpo-33199.TPnxQu.rst [new file with mode: 0644]
Objects/dictobject.c

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 (file)
index 0000000..22abf8d
--- /dev/null
@@ -0,0 +1,2 @@
+Fix ``ma_version_tag`` in dict implementation is uninitialized when copying
+from key-sharing dict.
index 8862be81482d282961461891a5a34211e26864b1..ddd05826ea5fbae30372f24616329e2047fb1473 100644 (file)
@@ -2654,6 +2654,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];