aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/python_append.i
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/python_append.i')
-rw-r--r--Examples/test-suite/python_append.i20
1 files changed, 19 insertions, 1 deletions
diff --git a/Examples/test-suite/python_append.i b/Examples/test-suite/python_append.i
index 049494319..883097ec6 100644
--- a/Examples/test-suite/python_append.i
+++ b/Examples/test-suite/python_append.i
@@ -42,13 +42,31 @@ import os.path
%}
%inline %{
-
class Test {
public:
static void static_func() {};
void funk() {};
};
+%}
+
+// Github issue #1674
+%extend ForSlots {
+ %pythoncode %{
+ __slots__ = ["this"]
+ %}
+}
+// While __slots__ does not contain 'ValidVariable' in the list, it is still possible
+// to set 'ValidVariable'. A little odd, but the whole attribute setting is bypassed
+// for setting C/C++ member variables.
+// Not sure how to test the equivalent for -builtin.
+%inline %{
+struct ForSlots {
+ int ValidVariable;
+ ForSlots() : ValidVariable(99) {}
+};
+%}
+%inline %{
#ifdef SWIGPYTHON_BUILTIN
bool is_python_builtin() { return true; }
#else