Skip to content

Commit d1c82c5

Browse files
authored
bpo-33199: Initialize ma_version_tag in PyDict_Copy (GH-6341)
1 parent a68f2f0 commit d1c82c5

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed
Lines changed: 2 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2551,6 +2551,7 @@ PyDict_Copy(PyObject *o)
25512551
split_copy->ma_values = newvalues;
25522552
split_copy->ma_keys = mp->ma_keys;
25532553
split_copy->ma_used = mp->ma_used;
2554+
split_copy->ma_version_tag = DICT_NEXT_VERSION();
25542555
DK_INCREF(mp->ma_keys);
25552556
for (i = 0, n = size; i < n; i++) {
25562557
PyObject *value = mp->ma_values[i];

0 commit comments

Comments
 (0)