From 33a8ec41235ebec7b185b9125fd8635aaf6507de Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sat, 5 Sep 2026 13:22:55 +0200 Subject: [PATCH] gh-129813: Fix typo in byteswriter_resize() (GH-156938) The intent is to test "resize and overallocate", even if in practice "resize & overallocate" is the same (both variables are either 0 or 1). Use "&&" to better describe the intent of the test. (cherry picked from commit 5141621d44e8ee88d97a5b8b225c8a32e7a343f0) Co-authored-by: Victor Stinner --- Objects/bytesobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index 33dc66eec62990..5fa20b9f6a4aaa 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -3629,7 +3629,7 @@ byteswriter_resize(PyBytesWriter *writer, Py_ssize_t size, int resize) return 0; } - if (resize & writer->overallocate) { + if (resize && writer->overallocate) { if (size <= (PY_SSIZE_T_MAX - size / OVERALLOCATE_FACTOR)) { size += size / OVERALLOCATE_FACTOR; }