summaryrefslogtreecommitdiff
path: root/tests/micropython/native.py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-08-24 16:28:17 +0100
committerDamien George <damien.p.george@gmail.com>2014-08-24 16:28:17 +0100
commit3c658a4e755a75e495303957208486e583ddb270 (patch)
tree6418fea9bf3dcf4aed2145db94fda4c0de1d0321 /tests/micropython/native.py
parent25fc41dd316c38df3e2a6cfe4b53322d76dc92fc (diff)
py: Fix bug where GC collected native/viper/asm function data.
Because (for Thumb) a function pointer has the LSB set, pointers to dynamic functions in RAM (eg native, viper or asm functions) were not being traced by the GC. This patch is a comprehensive fix for this. Addresses issue #820.
Diffstat (limited to 'tests/micropython/native.py')
-rw-r--r--tests/micropython/native.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/micropython/native.py b/tests/micropython/native.py
new file mode 100644
index 000000000..8f087c494
--- /dev/null
+++ b/tests/micropython/native.py
@@ -0,0 +1,10 @@
+@micropython.native
+def native_test(x):
+ print(1, [], x)
+
+native_test(2)
+
+# check that GC doesn't collect the native function
+import gc
+gc.collect()
+native_test(3)