Skip to content

Commit

Permalink
Address code review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Petr Ogarok <[email protected]>
  • Loading branch information
ogarokpeter committed Jun 18, 2024
1 parent 3143fb0 commit cf02f94
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
10 changes: 1 addition & 9 deletions cpp/csp/python/PyStructFastList_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -517,16 +517,8 @@ static PyObject * PyStructFastList_reduce( PyStructFastList<StorageT> * self, Py
CSP_BEGIN_METHOD;

typename VectorWrapper<StorageT>::IndexType sz = self -> vector.size();
PyObject * args = PyTuple_New( sz );
PyObjectPtr list = PyObjectPtr::own( toPython( self -> vector.getVector(), self -> arrayType ) );
for( typename VectorWrapper<StorageT>::IndexType index = 0; index < sz; ++index )
{
PyObject * value = PyList_GET_ITEM( list.ptr(), index );
Py_INCREF( value );
PyTuple_SET_ITEM( args, index, value );
}
PyObject * result = Py_BuildValue( "O(O)", &PyList_Type, args );
Py_INCREF( result );
PyObject * result = Py_BuildValue( "O(O)", &PyList_Type, list.ptr() );
return result;

CSP_RETURN_NULL;
Expand Down
11 changes: 2 additions & 9 deletions cpp/csp/python/PyStructList_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,15 +303,8 @@ static PyObject * PyStructList_reduce( PyStructList<StorageT> * self, PyObject *
CSP_BEGIN_METHOD;

typename VectorWrapper<StorageT>::IndexType sz = self -> vector.size();
PyObject * args = PyTuple_New( sz );
for( typename VectorWrapper<StorageT>::IndexType index = 0; index < sz; ++index )
{
PyObject * value = PyList_GET_ITEM( ( PyObject * ) self, index );
Py_INCREF( value );
PyTuple_SET_ITEM( args, index, value );
}
PyObject * result = Py_BuildValue( "O(O)", &PyList_Type, args );
Py_INCREF( result );
PyObjectPtr list = PyObjectPtr::own( toPython( self -> vector.getVector(), self -> arrayType ) );
PyObject * result = Py_BuildValue( "O(O)", &PyList_Type, list.ptr() );
return result;

CSP_RETURN_NULL;
Expand Down

0 comments on commit cf02f94

Please sign in to comment.