Skip to content

Commit 7c6e8a8

Browse files
committed
Simplify getting out ob_bytes
1 parent b5535d0 commit 7c6e8a8

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Objects/bytearrayobject.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,8 @@ PyByteArray_FromStringAndSize(const char *bytes, Py_ssize_t size)
157157
Py_DECREF(new);
158158
return NULL;
159159
}
160-
new->ob_bytes = PyBytes_AsString(new->ob_bytes_object);
161-
if (new->ob_bytes == NULL) {
162-
Py_DECREF(new);
163-
return PyErr_NoMemory();
164-
}
160+
new->ob_bytes = PyBytes_AS_STRING(new->ob_bytes_object);
161+
assert(new->ob_bytes);
165162
if (bytes != NULL && size > 0) {
166163
memcpy(new->ob_bytes, bytes, size);
167164
}

0 commit comments

Comments
 (0)