You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The python bindings for VtArray implements setting by index in terms of setting by slice, incrementing the index by 1 to create the slice. However, for -1, that creates an empty slice and the operation silently fails.
You can see that the second element from back was correctly set to 4.0 but the last element was not set to 2.0.
System Information (OS, Hardware)
Linux
Package Versions
Python 3.10
TBB 2020.3
Build Flags
--tests --no-imaging
The text was updated successfully, but these errors were encountered:
nvmkuruc
changed the title
Setting values via index in VtArray in python does not work with [-1] but does work correctly with other negative indices
Setting VtArray elements via index in python does not work with [-1] but does work correctly with other negative indices
Mar 10, 2023
@nvmkuruc good find! Are you interested in tackling this? We'd consider a contribution, for sure. Otherwise, we can pursue this internally, but it doesn't currently rise to the top of our internal priority list. Thank you!!
Happy to submit one, but didn't want to start in case there was a strong opinion about the best fix. My instinct is to just special case -1 and convert it to [-1 + size(), size()).
Description of Issue
The python bindings for
VtArray
implements setting by index in terms of setting by slice, incrementing the index by 1 to create the slice. However, for-1
, that creates an empty slice and the operation silently fails.Steps to Reproduce
testVtArray.py
ctest -C Release -R testVtArray
You should see the following error message.
You can see that the second element from back was correctly set to
4.0
but the last element was not set to2.0
.System Information (OS, Hardware)
Linux
Package Versions
Python 3.10
TBB 2020.3
Build Flags
--tests --no-imaging
The text was updated successfully, but these errors were encountered: