Fix bug with annotation description edits - #14186
Open
larsoner wants to merge 5 commits into
Open
Conversation
drammock
approved these changes
Aug 22, 2026
Comment on lines
+507
to
+513
| label or condition name). The array uses NumPy's variable-width | ||
| :obj:`~numpy.dtypes.StringDType`, so assigning a longer string into an | ||
| existing entry does not truncate it. | ||
|
|
||
| .. versionchanged:: 1.13 | ||
| Previously a fixed-width (``"<U"``) dtype was used, which silently | ||
| truncated values assigned in place. |
Member
There was a problem hiding this comment.
do we need this info in the user-facing docstring? If they're reading this version of the docs, they're not affected by the bug... and we usually do versionchanged for intentional behavior changes, not bugfixes (it wasn't intentional that truncation happened before)
| # Variable-width string dtype used for annotation descriptions. Unlike the fixed-width | ||
| # "<U" dtypes, it does not silently truncate when assigning into an existing array, | ||
| # e.g. ``annotations.description[0] = "a_much_longer_description"``. | ||
| _DESCRIPTION_DTYPE = np.dtypes.StringDType() |
Member
There was a problem hiding this comment.
[nitpick] a bit unexpected to use a variable for this. Is the motivation to just save a few characters? or is there some thought that we may want to easily change the dtype at some point in future? (I don't see why we would...)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In
main, creatingAnnotationsand then editing a description to be longer than the longest-width string silently truncates:By switching to NumPy 2.0's varible-width string dtype, on this branch it works:
Changes drafted by Claude Opus 5 and reviewed / understood by me.