https://github.com/python/cpython/commit/5141621d44e8ee88d97a5b8b225c8a32e7a343f0
commit: 5141621d44e8ee88d97a5b8b225c8a32e7a343f0
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-09-05T13:22:55+02:00
summary:
gh-129813: Fix typo in byteswriter_resize() (#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.
files:
M Objects/bytesobject.c
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index 4c3da93f101970..1b8dca73497415 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;
}
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]