Skip to content

Commit

Permalink
fix segfault #231 (#232)
Browse files Browse the repository at this point in the history
* fix segfault #231

* Update matrix_transform.h

PyGLM_TYPEERROR_1O already exists as PyGLM_TYPEERROR_O

* Update error_functions.h

PyGLM_TYPEERROR_1O already exists as PyGLM_TYPEERROR_O

---------

Co-authored-by: Zuzu-Typ <Zuzu.Typ@gmail.com>
  • Loading branch information
jimy-byerley and Zuzu-Typ authored Apr 21, 2024
1 parent 552e68f commit a27fd47
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion PyGLM/functions/stable_extensions/matrix_transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ translate_(PyObject*, PyObject* args) {
if (PyGLM_Vec_PTI_Check0(2, uint32, arg1)) {
return pack(glm::translate(glm::mat<3, 3, uint32>(1), PyGLM_Vec_PTI_Get0(2, uint32, arg1)));
}
PyGLM_TYPEERROR_O("invalid argument type for translate(): ", arg1);
}
else {
PyGLM_PTI_Init0(arg1, PyGLM_T_MAT | PyGLM_SHAPE_3x3 | PyGLM_SHAPE_4x4 | PyGLM_DT_NORMAL);
Expand All @@ -178,8 +179,8 @@ translate_(PyObject*, PyObject* args) {
if (PyGLM_Mat_PTI_Check0(3, 3, double, arg1) && PyGLM_Vec_PTI_Check1(2, double, arg2)) {
return pack(glm::translate(PyGLM_Mat_PTI_Get0(3, 3, double, arg1), PyGLM_Vec_PTI_Get1(2, double, arg2)));
}
PyGLM_TYPEERROR_2O("invalid argument types for translate(): ", arg1, arg2);
}
PyGLM_TYPEERROR_2O("invalid argument type(s) for translate(): ", arg1, arg2);
return NULL;
}

Expand Down
2 changes: 1 addition & 1 deletion PyGLM/internal_functions/error_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
#define PyGLM_Arg_Unpack_3O(args, name, arg1, arg2, arg3) if(!PyArg_UnpackTuple(args, name, 3, 3, &arg1, &arg2, &arg3)) return NULL
#define PyGLM_Arg_Unpack_4O(args, name, arg1, arg2, arg3, arg4) if(!PyArg_UnpackTuple(args, name, 4, 4, &arg1, &arg2, &arg3, &arg4)) return NULL
#define PyGLM_Arg_Unpack_5O(args, name, arg1, arg2, arg3, arg4, arg5) if(!PyArg_UnpackTuple(args, name, 5, 5, &arg1, &arg2, &arg3, &arg4, &arg5)) return NULL
#define PyGLM_Arg_Unpack_6O(args, name, arg1, arg2, arg3, arg4, arg5, arg6) if(!PyArg_UnpackTuple(args, name, 6, 6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6)) return NULL
#define PyGLM_Arg_Unpack_6O(args, name, arg1, arg2, arg3, arg4, arg5, arg6) if(!PyArg_UnpackTuple(args, name, 6, 6, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6)) return NULL

0 comments on commit a27fd47

Please sign in to comment.