mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-34436: Fix check that disables overallocation for the last fmt specifier (GH-8826)
Reported by Svace static analyzer.
This commit is contained in:
parent
65bef36f0b
commit
ccd9975267
1 changed files with 3 additions and 3 deletions
|
@ -819,8 +819,8 @@ _PyBytes_FormatEx(const char *format, Py_ssize_t format_len,
|
||||||
if (v == NULL)
|
if (v == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (fmtcnt < 0) {
|
if (fmtcnt == 0) {
|
||||||
/* last writer: disable writer overallocation */
|
/* last write: disable writer overallocation */
|
||||||
writer.overallocate = 0;
|
writer.overallocate = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1048,7 +1048,7 @@ _PyBytes_FormatEx(const char *format, Py_ssize_t format_len,
|
||||||
|
|
||||||
/* If overallocation was disabled, ensure that it was the last
|
/* If overallocation was disabled, ensure that it was the last
|
||||||
write. Otherwise, we missed an optimization */
|
write. Otherwise, we missed an optimization */
|
||||||
assert(writer.overallocate || fmtcnt < 0 || use_bytearray);
|
assert(writer.overallocate || fmtcnt == 0 || use_bytearray);
|
||||||
} /* until end */
|
} /* until end */
|
||||||
|
|
||||||
if (argidx < arglen && !dict) {
|
if (argidx < arglen && !dict) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue