summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2023-03-21 07:47:15 (GMT)
committerGitHub <noreply@github.com>2023-03-21 07:47:15 (GMT)
commit82eb9469e717e0047543732287a8342e646c2262 (patch)
tree4a1f46cc83ceea4efaa60a9ae73c2361c165da0a /Python/bytecodes.c
parent1a5a14183ec807ead1c6a46464540159124e5260 (diff)
downloadcpython-82eb9469e717e0047543732287a8342e646c2262.zip
cpython-82eb9469e717e0047543732287a8342e646c2262.tar.gz
cpython-82eb9469e717e0047543732287a8342e646c2262.tar.bz2
gh-102598: Remove obsolete optimization from `FORMAT_VALUE` opcode (#102599)
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r--Python/bytecodes.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 6c44870..ce2a58b 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -3026,20 +3026,10 @@ dummy_func(
value = result;
}
- /* If value is a unicode object, and there's no fmt_spec,
- then we know the result of format(value) is value
- itself. In that case, skip calling format(). I plan to
- move this optimization in to PyObject_Format()
- itself. */
- if (PyUnicode_CheckExact(value) && fmt_spec == NULL) {
- /* Do nothing, just transfer ownership to result. */
- result = value;
- } else {
- /* Actually call format(). */
- result = PyObject_Format(value, fmt_spec);
- DECREF_INPUTS();
- ERROR_IF(result == NULL, error);
- }
+ result = PyObject_Format(value, fmt_spec);
+ Py_DECREF(value);
+ Py_XDECREF(fmt_spec);
+ ERROR_IF(result == NULL, error);
}
inst(COPY, (bottom, unused[oparg-1] -- bottom, unused[oparg-1], top)) {