Skip to content

codegen: handle S160 multidimensional input size using array.size#2166

Open
rahur-NI wants to merge 5 commits intoni:masterfrom
rahur-NI:fix-multidim-size-codegen
Open

codegen: handle S160 multidimensional input size using array.size#2166
rahur-NI wants to merge 5 commits intoni:masterfrom
rahur-NI:fix-multidim-size-codegen

Conversation

@rahur-NI
Copy link
Contributor

  • This contribution adheres to CONTRIBUTING.md.
  • I've updated CHANGELOG.md if applicable.
  • I've added tests applicable for this pull request

What does this Pull Request accomplish?

This PR fixes the S160 size-parameter codegen path for input buffers so multidimensional arrays use total element count instead of first-dimension length.

Before this fix, S160 used len(array_name), which undercounted multidimensional inputs by returning only the first dimension; now it uses array_name.size when array_dimensions > 1 and preserves existing len(array_name) behavior for 1D/default inputs.

List issues fixed by this Pull Request below, if any.

What testing has been done?

  • Add a unit test for S160 with array_dimensions > 1 to verify .size is generated.
  • Keep the existing S160 1D test to verify len(...) behavior still works.
  • A successful tox execution

S130. Input enum: visatype.ViInt32(parameter_name.value)
S150. Input scalar: visatype.ViInt32(parameter_name)
S160. Input is size of input buffer: visatype.ViInt32(0 if list is None else len(list))
S160. Input is size of input buffer: visatype.ViInt32(0 if list is None else len(list)) or visatype.ViInt32(0 if array is None else array.size)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ni-jfitzger , should we add a new code for this case?

Copy link
Collaborator

@ni-jfitzger ni-jfitzger Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to this discussion thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants