Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: TStreamerLoop code generation should make an array #1277

Merged
merged 2 commits into from
Aug 23, 2024

Conversation

jpivarski
Copy link
Member

In #1275, @yixianz found that reading data with a TStreamerLoop did not raise an error (including the number of bytes check at the end of the object), but the data was a single scalar, rather than an array.

We've never seen an instance of TStreamerLoop before:

# untested as of PR #629

and (my guess for) the generated code was only a little wrong:

for tmp in range(self.member('fNp')):
    self._members['fPoly'] = c('TSplinePoly3').read(chunk, cursor, af.add_to_path(forth_obj, context, 'fPoly'), file, self._file, self.concrete)

instead of

self._members['fPoly'] = numpy.empty(self.member('fNp'), dtype='O')
for tmp in range(self.member('fNp')):
    self._members['fPoly'][tmp] = c('TSplinePoly3').read(chunk, cursor, af.add_to_path(forth_obj, context, 'fPoly'), file, self._file, self.concrete)

That is, I knew that it should read as many objects as in the referred-to member (fNp), but for some reason overwrote a single object instead of making an array of objects.

This PR fixes that. @yixianz's example file is now a part of the regular test suite.

@jpivarski jpivarski merged commit 448f20e into main Aug 23, 2024
24 checks passed
@jpivarski jpivarski deleted the jpivarski/fix-TStreamerLoop-code-generation branch August 23, 2024 21:46
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.

1 participant