bpo-33199: Initialize ma_version_tag in PyDict_Copy (GH-6341) · python/cpython@9a90826 (original) (raw)
File tree
2 files changed
lines changed
- Misc/NEWS.d/next/Core and Builtins
2 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
1 | +Fix ``ma_version_tag`` in dict implementation is uninitialized when copying | |
2 | +from key-sharing dict. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -2654,6 +2654,7 @@ PyDict_Copy(PyObject *o) | ||
2654 | 2654 | split_copy->ma_values = newvalues; |
2655 | 2655 | split_copy->ma_keys = mp->ma_keys; |
2656 | 2656 | split_copy->ma_used = mp->ma_used; |
2657 | +split_copy->ma_version_tag = DICT_NEXT_VERSION(); | |
2657 | 2658 | DK_INCREF(mp->ma_keys); |
2658 | 2659 | for (i = 0, n = size; i < n; i++) { |
2659 | 2660 | PyObject *value = mp->ma_values[i]; |