Skip to content

Commit c282610

Browse files
committed
fix merge conflicts
1 parent fd28e25 commit c282610

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

Objects/bytesobject.c

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2893,44 +2893,24 @@ _PyBytes_FromBuffer(PyObject *x)
28932893
static PyObject*
28942894
_PyBytes_FromSequence_lock_held(PyObject *x)
28952895
{
2896-
<<<<<<< HEAD
2897-
Py_ssize_t size = PySequence_Fast_GET_SIZE(x);
2898-
PyObject *bytes = _PyBytes_FromSize(size, 0);
2899-
if (bytes == NULL) {
2900-
return NULL;
2901-
}
2902-
char *str = PyBytes_AS_STRING(bytes);
2903-
PyObject *const *items = PySequence_Fast_ITEMS(x);
2904-
for (Py_ssize_t i = 0; i < size; i++) {
2905-
if (!PyLong_Check(items[i])) {
2906-
Py_DECREF(bytes);
2907-
/* Py_None as a fallback sentinel to the slow path */
2908-
Py_RETURN_NONE;
2909-
}
2910-
Py_ssize_t value = PyNumber_AsSsize_t(items[i], NULL);
2911-
if (value == -1 && PyErr_Occurred()) {
2912-
Py_DECREF(bytes);
2913-
return NULL;
2914-
}
2915-
=======
29162896
Py_ssize_t size = PySequence_Fast_GET_SIZE(x);
29172897
PyBytesWriter *writer = PyBytesWriter_Create(size);
29182898
if (writer == NULL) {
29192899
return NULL;
29202900
}
29212901
char *str = PyBytesWriter_GetData(writer);
2922-
assert _PyBytesWriter_GetAllocated(writer) >= size;
2902+
assert(_PyBytesWriter_GetAllocated(writer) >= size);
29232903

29242904
PyObject *const *items = PySequence_Fast_ITEMS(x);
29252905
for (Py_ssize_t i = 0; i < size; i++) {
29262906
if (!PyLong_Check(items[i])) {
2927-
Py_DECREF(bytes);
2907+
PyBytesWriter_Discard(writer);
29282908
/* Py_None as a fallback sentinel to the slow path */
29292909
Py_RETURN_NONE;
29302910
}
29312911
Py_ssize_t value = PyNumber_AsSsize_t(items[i], NULL);
29322912
if (value == -1 && PyErr_Occurred()) {
2933-
Py_DECREF(bytes);
2913+
PyBytesWriter_Discard(writer);
29342914
return NULL;
29352915
}
29362916

0 commit comments

Comments
 (0)