Details
-
Type:
Bug
-
Status: Won't Fix
-
Resolution: Done
-
Fix Version/s: None
-
Component/s: afw, ap, daf_base, meas_algorithms, meas_astrom, meas_extensions_multiShapelet, meas_modelfit, shapelet, utils
-
Labels:None
-
Team:SQuaRE
Description
In swig .i files code contained in %pythoncode %
{...%}blocks must be outdented to the left margin for the code to be reliably correctly indented in the interface file and and for comments that start with # to be reliably handled as comments.
Comments may have leading characters deleted (including the #) which can lead to part of the comment being treated as code. Another failure mode is that the comment has the wrong indentation level. Fortunately these errors usually result a syntax error, or are innocuous.
Incorrectly indented code can lead to errors that are very hard to detect. One common result is that the added function appears as as a function definition inside another function. Hence the failure produces no python syntax errors, but the added function cannot be called.
The problem does not always lead to improperly indented code and in some cases I suspect the code is being correctly indented, since I doubt it would work otherwise. Even then it is safest to fix the problem, if only to provide a correct example for others.
This sounds like a swig bug, can you include the swig bug report in the issue?
I agree that we probably have to fix it in our files too, but it's a lot of changes in a lot of places.