PyAPI: Make use of PyC_LongAs... API

Avoids setting exceptions inline,
also use Matrix_ParseAny for bmesh.ops.

Some inline exceptions are kept because they show useful details.
This commit is contained in:
2017-08-20 15:44:54 +10:00
parent a10a7f42de
commit 46cf33bf01
11 changed files with 70 additions and 98 deletions

View File

@@ -32,6 +32,8 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "../generic/py_capi_utils.h"
#ifndef MATH_STANDALONE
# include "BLI_dynstr.h"
#endif
@@ -403,7 +405,7 @@ static PyObject *Vector_resize(VectorObject *self, PyObject *value)
return NULL;
}
if ((size = PyLong_AsLong(value)) == -1) {
if ((size = PyC_Long_AsI32(value)) == -1) {
PyErr_SetString(PyExc_TypeError,
"Vector.resize(size): "
"expected size argument to be an integer");