Cleanup: py-gpu error checks
Move gpu initialization checks to the start of each function instead of mixing with argument parsing.
This commit is contained in:
@@ -47,6 +47,8 @@
|
||||
|
||||
static PyObject *bpygpu_IndexBuf_new(PyTypeObject *UNUSED(type), PyObject *args, PyObject *kwds)
|
||||
{
|
||||
BPYGPU_IS_INIT_OR_ERROR_OBJ;
|
||||
|
||||
const char *error_prefix = "IndexBuf.__new__";
|
||||
bool ok = true;
|
||||
|
||||
@@ -61,8 +63,7 @@ static PyObject *bpygpu_IndexBuf_new(PyTypeObject *UNUSED(type), PyObject *args,
|
||||
|
||||
static const char *_keywords[] = {"type", "seq", NULL};
|
||||
static _PyArg_Parser _parser = {"$O&O:IndexBuf.__new__", _keywords, 0};
|
||||
if (!bpygpu_is_initialized() ||
|
||||
!_PyArg_ParseTupleAndKeywordsFast(
|
||||
if (!_PyArg_ParseTupleAndKeywordsFast(
|
||||
args, kwds, &_parser,
|
||||
bpygpu_ParsePrimType, ¶ms.type_id,
|
||||
¶ms.seq))
|
||||
|
||||
Reference in New Issue
Block a user