Skip to content

Commit

Permalink
UPBGE: Clarify error message for bgl.Buffer when sizes doesn't match
Browse files Browse the repository at this point in the history
Requested by @TryExceptElse on irc.
the names dimension and template size are taken from the API:
https://pythonapi.upbge.org/bgl.html?highlight=bgl#bgl.Buffer

The message has been approved by TryExceptElse who is english native
  • Loading branch information
youle31 committed Sep 14, 2017
1 parent 9cc810a commit c8b5bb4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions source/blender/python/generic/bgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,9 +867,8 @@ static int Buffer_ass_slice(Buffer *self, int begin, int end, PyObject *seq)

/* re-use count var */
if ((count = PySequence_Size(seq)) != (end - begin)) {
PyErr_Format(PyExc_TypeError,
"buffer[:] = value, size mismatch in assignment. "
"Expected: %d (given: %d)", count, end - begin);
PyErr_Format(PyExc_ValueError,
"Mismatch in assignment. bgl.Buffer dimension: %d and template size: %d", end - begin, count);
return -1;
}

Expand Down

0 comments on commit c8b5bb4

Please sign in to comment.