summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorAN Long <aisk@users.noreply.github.com>2023-11-03 04:06:51 (GMT)
committerGitHub <noreply@github.com>2023-11-03 04:06:51 (GMT)
commit3a1b09e6d070778d78d81084f88d37377d38ee9b (patch)
tree5efea6278e50c66ed62537fbf52105a6c477a734 /Python
parent93206d19a35106f64a1aef5fa25eb18966970534 (diff)
downloadcpython-3a1b09e6d070778d78d81084f88d37377d38ee9b.zip
cpython-3a1b09e6d070778d78d81084f88d37377d38ee9b.tar.gz
cpython-3a1b09e6d070778d78d81084f88d37377d38ee9b.tar.bz2
gh-111654: remove redundant decref in LOAD_FROM_DICT_OR_DEREF (#111655)
Diffstat (limited to 'Python')
-rw-r--r--Python/bytecodes.c3
-rw-r--r--Python/executor_cases.c.h3
-rw-r--r--Python/generated_cases.c.h3
3 files changed, 3 insertions, 6 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 9f1dfa3..ddaae32 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -1535,10 +1535,8 @@ dummy_func(
assert(oparg >= 0 && oparg < _PyFrame_GetCode(frame)->co_nlocalsplus);
name = PyTuple_GET_ITEM(_PyFrame_GetCode(frame)->co_localsplusnames, oparg);
if (PyMapping_GetOptionalItem(class_dict, name, &value) < 0) {
- Py_DECREF(class_dict);
GOTO_ERROR(error);
}
- Py_DECREF(class_dict);
if (!value) {
PyObject *cell = GETLOCAL(oparg);
value = PyCell_GET(cell);
@@ -1548,6 +1546,7 @@ dummy_func(
}
Py_INCREF(value);
}
+ Py_DECREF(class_dict);
}
inst(LOAD_DEREF, ( -- value)) {
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h
index 903fc40..eb56c34 100644
--- a/Python/executor_cases.c.h
+++ b/Python/executor_cases.c.h
@@ -1241,10 +1241,8 @@
assert(oparg >= 0 && oparg < _PyFrame_GetCode(frame)->co_nlocalsplus);
name = PyTuple_GET_ITEM(_PyFrame_GetCode(frame)->co_localsplusnames, oparg);
if (PyMapping_GetOptionalItem(class_dict, name, &value) < 0) {
- Py_DECREF(class_dict);
GOTO_ERROR(error);
}
- Py_DECREF(class_dict);
if (!value) {
PyObject *cell = GETLOCAL(oparg);
value = PyCell_GET(cell);
@@ -1254,6 +1252,7 @@
}
Py_INCREF(value);
}
+ Py_DECREF(class_dict);
stack_pointer[-1] = value;
break;
}
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index 38c368f..5c3a579 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -2204,10 +2204,8 @@
assert(oparg >= 0 && oparg < _PyFrame_GetCode(frame)->co_nlocalsplus);
name = PyTuple_GET_ITEM(_PyFrame_GetCode(frame)->co_localsplusnames, oparg);
if (PyMapping_GetOptionalItem(class_dict, name, &value) < 0) {
- Py_DECREF(class_dict);
GOTO_ERROR(error);
}
- Py_DECREF(class_dict);
if (!value) {
PyObject *cell = GETLOCAL(oparg);
value = PyCell_GET(cell);
@@ -2217,6 +2215,7 @@
}
Py_INCREF(value);
}
+ Py_DECREF(class_dict);
stack_pointer[-1] = value;
DISPATCH();
}