Merged
Conversation
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.
This pull request enhances the assignment capabilities for struct array fields in the
dwarffilibrary, making array assignment more flexible and robust. The changes introduce support for assigning lists, tuples, andBoundArrayViewobjects directly to array fields, improve error handling, and add comprehensive tests to cover these new behaviors.Array assignment enhancements:
__setattr__method insrc/dwarffi/instances.pynow supports direct assignment of Python lists, tuples, andBoundArrayViewobjects to array fields, in addition to the previous support for strings and bytes. This allows for element-wise assignment and fast zero-copy memory slices for compatible types.int) to an array field now raises aTypeErrorwith a clear message, instead of aNotImplementedError.Testing improvements:
tests/test_struct_array_assignment.pyhas been updated to expect aTypeError(with the new error message) for invalid array assignments.test_array_advanced_assignment, has been added intests/test_struct_array_assignment_advanced.pyto verify assignment of lists, tuples, andBoundArrayViewobjects to array fields, as well as to check correct error handling for size and type mismatches.