mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
gh-102598: Remove obsolete optimization from FORMAT_VALUE
opcode (#102599)
This commit is contained in:
parent
1a5a14183e
commit
82eb9469e7
2 changed files with 21 additions and 44 deletions
|
@ -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)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue