summaryrefslogtreecommitdiff
path: root/Doc
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2023-05-15 11:09:13 +1200
committerOlly Betts <olly@survex.com>2023-05-15 11:09:13 +1200
commit10ca0edddb77e1a1a78e073b636af8d1f89eac41 (patch)
treed2d2e982d6ed97f4b7bf306bc0ea7ab0f7adfc94 /Doc
parente8607a95b0614cbf33ad9586e40f487af3cca6e2 (diff)
downloadswig-10ca0edddb77e1a1a78e073b636af8d1f89eac41.tar.gz
Add %rename to %pythoncode example
Without this you get two set_transform() functions defined in the .py file, which can trigger warnings from linting tools. Renaming the SWIG-generated wrapper is a reasonably clean solution (though does leave an unused _set_transform() Python function). See #2578
Diffstat (limited to 'Doc')
-rw-r--r--Doc/Manual/Python.html8
1 files changed, 7 insertions, 1 deletions
diff --git a/Doc/Manual/Python.html b/Doc/Manual/Python.html
index 74f5167ea..a5175daf3 100644
--- a/Doc/Manual/Python.html
+++ b/Doc/Manual/Python.html
@@ -3425,9 +3425,15 @@ For example:
<div class="code">
<pre>
+/* Rename the SWIG-generated wrapper. */
+%rename _set_transform set_transform;
+
+...
+
void set_transform(Image *im, double x[4][4]);
...
+
/* Rewrite the high level interface to set_transform */
%pythoncode %{
def set_transform(im, x):
@@ -3435,7 +3441,7 @@ def set_transform(im, x):
for i in range(4):
for j in range(4):
mat44_set(a, i, j, x[i][j])
- _example.set_transform(im, a)
+ _example._set_transform(im, a)
free_mat44(a)
%}
</pre>