Skip to content

Commit 9a90826

Browse files
bpo-33199: Initialize ma_version_tag in PyDict_Copy (pythonGH-6341)
(cherry picked from commit d1c82c5) Co-authored-by: INADA Naoki <[email protected]>
1 parent 306559e commit 9a90826

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix ``ma_version_tag`` in dict implementation is uninitialized when copying
2+
from key-sharing dict.

Objects/dictobject.c

+1
Original file line numberDiff line numberDiff line change
@@ -2654,6 +2654,7 @@ PyDict_Copy(PyObject *o)
26542654
split_copy->ma_values = newvalues;
26552655
split_copy->ma_keys = mp->ma_keys;
26562656
split_copy->ma_used = mp->ma_used;
2657+
split_copy->ma_version_tag = DICT_NEXT_VERSION();
26572658
DK_INCREF(mp->ma_keys);
26582659
for (i = 0, n = size; i < n; i++) {
26592660
PyObject *value = mp->ma_values[i];

0 commit comments

Comments
 (0)