diff options
author | Sam Gross <colesbury@gmail.com> | 2024-10-01 16:39:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-01 16:39:56 (GMT) |
commit | 5aa91c56bf14c38b4c7f5ccaaa3cd24fe3fb0f04 (patch) | |
tree | 60b3e8d6790d7e54c3f507dc5ddb16ac548b076a /Python | |
parent | 60ff67d010078eca15a74b1429caf779ac4f9c74 (diff) | |
download | cpython-5aa91c56bf14c38b4c7f5ccaaa3cd24fe3fb0f04.zip cpython-5aa91c56bf14c38b4c7f5ccaaa3cd24fe3fb0f04.tar.gz cpython-5aa91c56bf14c38b4c7f5ccaaa3cd24fe3fb0f04.tar.bz2 |
gh-124296: Remove private dictionary version tag (PEP 699) (#124472)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bytecodes.c | 4 | ||||
-rw-r--r-- | Python/executor_cases.c.h | 4 | ||||
-rw-r--r-- | Python/generated_cases.c.h | 4 | ||||
-rw-r--r-- | Python/optimizer_analysis.c | 4 |
4 files changed, 5 insertions, 11 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 8535306..c712c77 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -2254,7 +2254,6 @@ dummy_func( PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); DEOPT_IF(hint >= (size_t)dict->ma_keys->dk_nentries); PyObject *old_value; - uint64_t new_version; DEOPT_IF(!DK_IS_UNICODE(dict->ma_keys)); PyDictUnicodeEntry *ep = DK_UNICODE_ENTRIES(dict->ma_keys) + hint; DEOPT_IF(ep->me_key != name); @@ -2264,9 +2263,8 @@ dummy_func( } old_value = ep->me_value; PyDict_WatchEvent event = old_value == NULL ? PyDict_EVENT_ADDED : PyDict_EVENT_MODIFIED; - new_version = _PyDict_NotifyEvent(tstate->interp, event, dict, name, PyStackRef_AsPyObjectBorrow(value)); + _PyDict_NotifyEvent(tstate->interp, event, dict, name, PyStackRef_AsPyObjectBorrow(value)); ep->me_value = PyStackRef_AsPyObjectSteal(value); - dict->ma_version_tag = new_version; // PEP 509 // old_value should be DECREFed after GC track checking is done, if not, it could raise a segmentation fault, // when dict only holds the strong reference to value in ep->me_value. Py_XDECREF(old_value); diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h index 650bf45..fdfec66 100644 --- a/Python/executor_cases.c.h +++ b/Python/executor_cases.c.h @@ -2625,7 +2625,6 @@ JUMP_TO_JUMP_TARGET(); } PyObject *old_value; - uint64_t new_version; if (!DK_IS_UNICODE(dict->ma_keys)) { UOP_STAT_INC(uopcode, miss); JUMP_TO_JUMP_TARGET(); @@ -2641,9 +2640,8 @@ } old_value = ep->me_value; PyDict_WatchEvent event = old_value == NULL ? PyDict_EVENT_ADDED : PyDict_EVENT_MODIFIED; - new_version = _PyDict_NotifyEvent(tstate->interp, event, dict, name, PyStackRef_AsPyObjectBorrow(value)); + _PyDict_NotifyEvent(tstate->interp, event, dict, name, PyStackRef_AsPyObjectBorrow(value)); ep->me_value = PyStackRef_AsPyObjectSteal(value); - dict->ma_version_tag = new_version; // PEP 509 // old_value should be DECREFed after GC track checking is done, if not, it could raise a segmentation fault, // when dict only holds the strong reference to value in ep->me_value. Py_XDECREF(old_value); diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 1201fe8..9de7554 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -6940,7 +6940,6 @@ PyObject *name = GETITEM(FRAME_CO_NAMES, oparg); DEOPT_IF(hint >= (size_t)dict->ma_keys->dk_nentries, STORE_ATTR); PyObject *old_value; - uint64_t new_version; DEOPT_IF(!DK_IS_UNICODE(dict->ma_keys), STORE_ATTR); PyDictUnicodeEntry *ep = DK_UNICODE_ENTRIES(dict->ma_keys) + hint; DEOPT_IF(ep->me_key != name, STORE_ATTR); @@ -6950,9 +6949,8 @@ } old_value = ep->me_value; PyDict_WatchEvent event = old_value == NULL ? PyDict_EVENT_ADDED : PyDict_EVENT_MODIFIED; - new_version = _PyDict_NotifyEvent(tstate->interp, event, dict, name, PyStackRef_AsPyObjectBorrow(value)); + _PyDict_NotifyEvent(tstate->interp, event, dict, name, PyStackRef_AsPyObjectBorrow(value)); ep->me_value = PyStackRef_AsPyObjectSteal(value); - dict->ma_version_tag = new_version; // PEP 509 // old_value should be DECREFed after GC track checking is done, if not, it could raise a segmentation fault, // when dict only holds the strong reference to value in ep->me_value. Py_XDECREF(old_value); diff --git a/Python/optimizer_analysis.c b/Python/optimizer_analysis.c index b202b58..f30e873 100644 --- a/Python/optimizer_analysis.c +++ b/Python/optimizer_analysis.c @@ -56,14 +56,14 @@ static int get_mutations(PyObject* dict) { assert(PyDict_CheckExact(dict)); PyDictObject *d = (PyDictObject *)dict; - return (d->ma_version_tag >> DICT_MAX_WATCHERS) & ((1 << DICT_WATCHED_MUTATION_BITS)-1); + return (d->_ma_watcher_tag >> DICT_MAX_WATCHERS) & ((1 << DICT_WATCHED_MUTATION_BITS)-1); } static void increment_mutations(PyObject* dict) { assert(PyDict_CheckExact(dict)); PyDictObject *d = (PyDictObject *)dict; - d->ma_version_tag += (1 << DICT_MAX_WATCHERS); + d->_ma_watcher_tag += (1 << DICT_MAX_WATCHERS); } /* The first two dict watcher IDs are reserved for CPython, |