summaryrefslogtreecommitdiffstats
path: root/Python/specialize.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2022-08-01 13:34:54 (GMT)
committerGitHub <noreply@github.com>2022-08-01 13:34:54 (GMT)
commitde388c0a7b71c094d36ce40fecef87bdbb8a87d3 (patch)
treeb2318318e6c9a80bc9f45ecf5fc05aa66efb7825 /Python/specialize.c
parentfb75d015f487e50079e8d2ea7859750684b124e4 (diff)
downloadcpython-de388c0a7b71c094d36ce40fecef87bdbb8a87d3.zip
cpython-de388c0a7b71c094d36ce40fecef87bdbb8a87d3.tar.gz
cpython-de388c0a7b71c094d36ce40fecef87bdbb8a87d3.tar.bz2
GH-95245: Store object values and dict pointers in single tagged pointer. (GH-95278)
Diffstat (limited to 'Python/specialize.c')
-rw-r--r--Python/specialize.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Python/specialize.c b/Python/specialize.c
index 53b2ae8..d5877a1 100644
--- a/Python/specialize.c
+++ b/Python/specialize.c
@@ -635,9 +635,8 @@ specialize_dict_access(
return 0;
}
_PyAttrCache *cache = (_PyAttrCache *)(instr + 1);
- PyObject **dictptr = _PyObject_ManagedDictPointer(owner);
- PyDictObject *dict = (PyDictObject *)*dictptr;
- if (dict == NULL) {
+ PyDictOrValues dorv = *_PyObject_DictOrValuesPointer(owner);
+ if (_PyDictOrValues_IsValues(dorv)) {
// Virtual dictionary
PyDictKeysObject *keys = ((PyHeapTypeObject *)type)->ht_cached_keys;
assert(PyUnicode_CheckExact(name));
@@ -652,7 +651,8 @@ specialize_dict_access(
_Py_SET_OPCODE(*instr, values_op);
}
else {
- if (!PyDict_CheckExact(dict)) {
+ PyDictObject *dict = (PyDictObject *)_PyDictOrValues_GetDict(dorv);
+ if (dict == NULL || !PyDict_CheckExact(dict)) {
SPECIALIZATION_FAIL(base_op, SPEC_FAIL_NO_DICT);
return 0;
}
@@ -995,9 +995,9 @@ PyObject *descr, DescriptorClassification kind)
ObjectDictKind dictkind;
PyDictKeysObject *keys;
if (owner_cls->tp_flags & Py_TPFLAGS_MANAGED_DICT) {
- PyObject *dict = *_PyObject_ManagedDictPointer(owner);
+ PyDictOrValues dorv = *_PyObject_DictOrValuesPointer(owner);
keys = ((PyHeapTypeObject *)owner_cls)->ht_cached_keys;
- if (dict == NULL) {
+ if (_PyDictOrValues_IsValues(dorv)) {
dictkind = MANAGED_VALUES;
}
else {