rdiankov / openrave

Open Robotics Automation Virtual Environment: An environment for testing, developing, and deploying robotics motion planning algorithms.
http://www.openrave.org
Other
687 stars 340 forks source link

Throw exception if input is non-contiguous for ExtractContiguousArrayToPointer #1343

Closed YutaKojio closed 6 months ago

YutaKojio commented 7 months ago

If an input for ExtractContiguousArrayToPointer is numpy array with non-contiguous memory, PyArray_GETCONTIGUOUS creates copy, not returns reference of the input. In this case, the reference count for arrPtr is 1, and it is decreased to 0 by the destructor of AutoPyArrayObjectDereferencer when exiting this function. This causes an unexpected behavior since the memory is released and the data can be destroyed.

This MR changes to throw excepetion for that case to be aware of unintended usage.

Pipeline #702392

rdiankov commented 7 months ago

Maybe no need to increment patch for such a minor change

YutaKojio commented 7 months ago

sure. I reverted the version change.

rdiankov commented 6 months ago

thanks~