summaryrefslogtreecommitdiff
path: root/Examples/test-suite/python/director_pass_by_value_runme.py
diff options
context:
space:
mode:
authorJoel Andersson <j.a.e.andersson@gmail.com>2016-07-02 19:05:42 -0500
committerJoel Andersson <j.a.e.andersson@gmail.com>2016-07-02 19:05:42 -0500
commit3703053cbe25655e3e20d7ddc0f621c3e7c6d47d (patch)
treed0b57df47e258ff9ff3d976c20630af91c3d4010 /Examples/test-suite/python/director_pass_by_value_runme.py
parentb5e75d1891a64000508b511e220483b0547f5428 (diff)
parent36bbeb478dfcecc7739284cd454ada8b4cb96333 (diff)
downloadswig-3703053cbe25655e3e20d7ddc0f621c3e7c6d47d.tar.gz
Merge branch 'master' of https://github.com/swig/swig into matlab
Diffstat (limited to 'Examples/test-suite/python/director_pass_by_value_runme.py')
-rw-r--r--Examples/test-suite/python/director_pass_by_value_runme.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Examples/test-suite/python/director_pass_by_value_runme.py b/Examples/test-suite/python/director_pass_by_value_runme.py
new file mode 100644
index 000000000..7744db962
--- /dev/null
+++ b/Examples/test-suite/python/director_pass_by_value_runme.py
@@ -0,0 +1,13 @@
+import director_pass_by_value
+
+passByVal = None
+class director_pass_by_value_Derived(director_pass_by_value.DirectorPassByValueAbstractBase):
+ def virtualMethod(self, b):
+ global passByVal
+ passByVal = b
+
+# bug was the passByVal global object was destroyed after the call to virtualMethod had finished.
+director_pass_by_value.Caller().call_virtualMethod(director_pass_by_value_Derived())
+ret = passByVal.getVal();
+if ret != 0x12345678:
+ raise RuntimeError("Bad return value, got " + hex(ret))