There was an error while loading. Please reload this page.
1 parent b2bfbce commit fc3cd8eCopy full SHA for fc3cd8e
1 file changed
Objects/stringlib/join.h
@@ -134,13 +134,15 @@ STRINGLIB(bytes_join)(PyObject *sep, PyObject *iterable)
134
}
135
136
else {
137
- for (i = 0; i < nbufs; i++) {
138
- Py_ssize_t n;
139
- char *q;
140
- if (i) {
141
- memcpy(p, sepstr, seplen);
142
- p += seplen;
143
- }
+ Py_ssize_t n = buffers[0].len;
+ char *q = buffers[0].buf;
+ memcpy(p, q, n);
+ p += n;
+
+ for (i = 1; i < nbufs; i++) {
+ memcpy(p, sepstr, seplen);
144
+ p += seplen;
145
146
n = buffers[i].len;
147
q = buffers[i].buf;
148
memcpy(p, q, n);
0 commit comments