Skip to content

Commit 57a4f12

Browse files
committed
Refs #23753. Apply suggestions
Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>
1 parent 10bfb67 commit 57a4f12

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

fastdds_python/src/swig/fastdds/rtps/common/InstanceHandle.i

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ long hash(const eprosima::fastdds::rtps::InstanceHandle_t& handle)
4343

4444
%extend eprosima::fastdds::rtps::InstanceHandleValue_t {
4545

46-
// Constructor from sequence of 16 bytes (tupla/lista/bytes/bytearray)
46+
// Constructor from a sequence of 16 bytes (tuple/list/bytes/bytearray)
4747
InstanceHandleValue_t(PyObject* seq) {
4848
eprosima::fastdds::rtps::InstanceHandleValue_t* self = new eprosima::fastdds::rtps::InstanceHandleValue_t();
4949
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
@@ -85,7 +85,7 @@ long hash(const eprosima::fastdds::rtps::InstanceHandle_t& handle)
8585
if (it)
8686
{
8787
PyObject* item {nullptr};
88-
while ((item = PyIter_Next(it)))
88+
while ((item = PyIter_Next(it)) && count < 16)
8989
{
9090
long val = PyLong_AsLong(item);
9191
Py_DECREF(item);
@@ -171,12 +171,12 @@ long hash(const eprosima::fastdds::rtps::InstanceHandle_t& handle)
171171

172172
// Setter from sequence (tuple/list/bytes/bytearray)
173173
void from_sequence(PyObject* seq) {
174-
// Reutiliza el constructor para validar y copiar
174+
// Reuse the constructor to validate and copy
175175
eprosima::fastdds::rtps::InstanceHandleValue_t* tmp = new_eprosima_fastdds_rtps_InstanceHandleValue_t(seq);
176176
if (nullptr != tmp)
177177
{
178178
for (int i = 0; i < 16; ++i) $self->value[i] = (*tmp)[i];
179-
delete tmp; // evitar fuga
179+
delete tmp; // avoid memory leak
180180
}
181181
}
182182

0 commit comments

Comments
 (0)