Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-2346

SWIG code enclosed in %python %{ should be outdented to the left margin



    • Team:


      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.



          rowen Russell Owen created issue -
          swinbank John Swinbank made changes -
          Field Original Value New Value
          Team SQuaRE [ 10302 ]
          ktl Kian-Tat Lim made changes -
          Comment [ Delivery is delayed to these recipients or groups:


          Subject: [JIRA] (DM-2346) SWIG code enclosed in %python %{ should be outdented to the left margin

          This message hasn't been delivered yet. Delivery will continue to be attempted.

          The server will keep trying to deliver this message for the next 1 days, 19 hours and 58 minutes. You'll be notified if the message can't be delivered by that time.
          swinbank John Swinbank made changes -
          Assignee Robert Lupton [ rhl ]
          swinbank John Swinbank made changes -
          Resolution Done [ 10000 ]
          Status To Do [ 10001 ] Won't Fix [ 10405 ]


            Unassigned Unassigned
            rowen Russell Owen
            Jim Bosch, John Swinbank, Kian-Tat Lim, Paul Price, Robert Lupton, Robyn Allsman [X] (Inactive), Russell Owen, Serge Monkewitz, Simon Krughoff, Tim Jenness
            0 Vote for this issue
            10 Start watching this issue




                No builds found.