Skip to content

Commit e07b4a3

Browse files
hjmjohnsonclaude
andcommitted
COMP: Use verbatim %{ %} block for Image __array__ pythoncode
The %pythoncode { ... } form (single brace) processes its contents through the SWIG preprocessor, so '#' comments at the start of lines are misinterpreted as preprocessor directives: pyBase.i:702: Error: Unknown SWIG preprocessor directive: Explicit pyBase.i:706: Error: Unknown SWIG preprocessor directive: Zero Switch to %pythoncode %{ ... %} (verbatim block) so the embedded Python code is passed through unchanged. This matches the form already used by DECL_PYTHON_POINTSETBASE_CLASS and the existing __buffer__ block. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5da7fe7 commit e07b4a3

File tree

1 file changed

+2
-2
lines changed
  • Wrapping/Generators/Python/PyBase

1 file changed

+2
-2
lines changed

Wrapping/Generators/Python/PyBase/pyBase.i

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ str = str
679679
680680
%define DECL_PYTHON_IMAGE_CLASS(swig_name)
681681
%extend swig_name {
682-
%pythoncode {
682+
%pythoncode %{
683683
def __array__(self, dtype=None, copy=None):
684684
"""Return a NumPy array from this image.
685685

@@ -717,7 +717,7 @@ str = str
717717
if copy is False:
718718
return array
719719
return array
720-
}
720+
%}
721721
}
722722
%enddef
723723

0 commit comments

Comments
 (0)