summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2015-01-09 14:50:15 +1300
committerOlly Betts <olly@survex.com>2015-01-09 14:52:46 +1300
commit4b5ed45d50349e762ecae221ea5a516da15ba6ac (patch)
tree96dda4a350c9b2ab61bee3c1cbb5a769cde1e97d
parentefb8784c8b9240bac0868f2de3ac70289aea9b0d (diff)
downloadswig-4b5ed45d50349e762ecae221ea5a516da15ba6ac.tar.gz
Add note about delimiting blocks of Python code
Using { and } to delimit means Python comments will cause errors with SWIG 3.0.3 and later. With older SWIG it usually just meant such comments failed to appear in the generated output. See issue #221.
-rw-r--r--Doc/Manual/Python.html12
1 files changed, 12 insertions, 0 deletions
diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html
index 234117464..eb102aa3e 100644
--- a/Doc/Manual/Python.html
+++ b/Doc/Manual/Python.html
@@ -3368,6 +3368,18 @@ print("Loading", "Whizz", "Bang", sep=' ... ')
</pre>
</div>
+<p>When using <tt>%pythoncode</tt> and <tt>%pythonbegin</tt> you generally
+want to make sure that the block is delimited by <tt>%{</tt> and <tt>%}</tt>.
+If you delimit it with <tt>{</tt> and <tt>}</tt> then any lines with a
+leading <tt>#</tt> will be handled by SWIG as preprocessor directives, when
+you probably meant them as Python comments. Prior to SWIG 3.0.3, invalid
+preprocessor directives were silently ignored, so generally using the wrong
+delimiters resulted in such comments not appearing in the generated output
+(though a comment starting with a valid preprocessor directive could cause
+problems, for example: <tt># error handling</tt>). SWIG 3.0.3 and later report
+an error for invalid preprocessor directives, so you may have to update
+existing interface files to delimit blocks of Python code correctly.</p>
+
<p>Sometimes you may want to replace or modify the wrapper function
that SWIG creates in the proxy <tt>.py</tt> file. The Python module
in SWIG provides some features that enable you to do this. First, to