Fix hydra API, incorrect Python API handling of invalid arguments

Exceptions must return nullptr, not None.
This commit is contained in:
Campbell Barton 2023-08-07 22:06:26 +10:00
parent b086bd411e
commit 0f120b6364
1 changed files with 7 additions and 7 deletions

View File

@ -33,7 +33,7 @@ static PyObject *engine_create_func(PyObject * /*self*/, PyObject *args)
PyObject *pyengine;
char *engine_type, *render_delegate_id;
if (!PyArg_ParseTuple(args, "Oss", &pyengine, &engine_type, &render_delegate_id)) {
Py_RETURN_NONE;
return nullptr;
}
RenderEngine *bl_engine = pyrna_to_pointer<RenderEngine>(pyengine, &RNA_RenderEngine);
@ -63,7 +63,7 @@ static PyObject *engine_free_func(PyObject * /*self*/, PyObject *args)
{
PyObject *pyengine;
if (!PyArg_ParseTuple(args, "O", &pyengine)) {
Py_RETURN_NONE;
return nullptr;
}
Engine *engine = static_cast<Engine *>(PyLong_AsVoidPtr(pyengine));
@ -77,7 +77,7 @@ static PyObject *engine_update_func(PyObject * /*self*/, PyObject *args)
{
PyObject *pyengine, *pydepsgraph, *pycontext;
if (!PyArg_ParseTuple(args, "OOO", &pyengine, &pydepsgraph, &pycontext)) {
Py_RETURN_NONE;
return nullptr;
}
Engine *engine = static_cast<Engine *>(PyLong_AsVoidPtr(pyengine));
@ -94,7 +94,7 @@ static PyObject *engine_render_func(PyObject * /*self*/, PyObject *args)
{
PyObject *pyengine;
if (!PyArg_ParseTuple(args, "O", &pyengine)) {
Py_RETURN_NONE;
return nullptr;
}
Engine *engine = static_cast<Engine *>(PyLong_AsVoidPtr(pyengine));
@ -113,7 +113,7 @@ static PyObject *engine_view_draw_func(PyObject * /*self*/, PyObject *args)
{
PyObject *pyengine, *pycontext;
if (!PyArg_ParseTuple(args, "OO", &pyengine, &pycontext)) {
Py_RETURN_NONE;
return nullptr;
}
ViewportEngine *engine = static_cast<ViewportEngine *>(PyLong_AsVoidPtr(pyengine));
@ -152,7 +152,7 @@ static PyObject *engine_set_render_setting_func(PyObject * /*self*/, PyObject *a
PyObject *pyengine, *pyval;
char *key;
if (!PyArg_ParseTuple(args, "OsO", &pyengine, &key, &pyval)) {
Py_RETURN_NONE;
return nullptr;
}
Engine *engine = static_cast<Engine *>(PyLong_AsVoidPtr(pyengine));
@ -167,7 +167,7 @@ static PyObject *cache_or_get_image_file_func(PyObject * /*self*/, PyObject *arg
{
PyObject *pycontext, *pyimage;
if (!PyArg_ParseTuple(args, "OO", &pycontext, &pyimage)) {
Py_RETURN_NONE;
return nullptr;
}
bContext *context = static_cast<bContext *>(PyLong_AsVoidPtr(pycontext));