Replace the only Jinja macro with Python code#267
Merged
avalentino merged 1 commit intoJun 8, 2026
Conversation
eerovaher
commented
Jun 8, 2026
Comment on lines
+205
to
+208
| # note: one can only have 1 or 2 dimensions | ||
| lines.append( | ||
| f"int copy_{name} = (is_{name}0 != sizeof({self.ctype}));" | ||
| if self.ndim <= 1 |
Contributor
Author
There was a problem hiding this comment.
Based on the comment I would have expected that we could check if self.ndim == 1, but turns out that it is necessary to use <= instead of == because in a few cases self.ndim is 0. Furthermore, in the templates the Argument.ndim property is always used as arg.ndim or 1, and this function also uses the analogous self.ndim or 1. I am getting the impression that something is being set up wrong, and instead of fixing the problem where it occurs the current code contains workarounds wherever the problem is encountered. I'll have to investigate what the real problem is and how to solve it.
avalentino
approved these changes
Jun 8, 2026
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.
I am not aware of any good reasons why code should be written as Jinja macros rather than Python functions. Luckily it is not very complicated to get rid of the macros because there is only one.