From 2a1c0a811525dd5642f32f0ccf9fb7fcbe303684 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 4 Sep 2026 16:05:24 +0200 Subject: [PATCH] gh-129813: Fix typo in byteswriter_resize() 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. --- Objects/bytesobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index 4c3da93f1019709..1b8dca734974153 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; }