summaryrefslogtreecommitdiffstatshomepage
path: root/tests/misc/recursive_data.py_
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-06-28 02:25:04 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-06-28 02:25:04 +0300
commit8993fb6cf0677ce980ab56cbad326e4e6bc47811 (patch)
treec40ec3264ff4e6ff2574bf3f8c465ab406cfa631 /tests/misc/recursive_data.py_
parent7e4ec3bf4f90232d3193425519ed0fc1b708c27f (diff)
downloadmicropython-8993fb6cf0677ce980ab56cbad326e4e6bc47811.tar.gz
micropython-8993fb6cf0677ce980ab56cbad326e4e6bc47811.zip
py: Add protection against printing too nested or recursive data structures.
With a test which cannot be automatically validated so far.
Diffstat (limited to 'tests/misc/recursive_data.py_')
-rw-r--r--tests/misc/recursive_data.py_9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/misc/recursive_data.py_ b/tests/misc/recursive_data.py_
new file mode 100644
index 0000000000..6a52a3c0e8
--- /dev/null
+++ b/tests/misc/recursive_data.py_
@@ -0,0 +1,9 @@
+# This tests that printing recursive data structure doesn't lead to segfault.
+# Unfortunately, print() so far doesn't support "file "kwarg, so variable-len
+# output of this test cannot be redirected, and this test cannot be validated.
+l = [1, 2, 3, None]
+l[-1] = l
+try:
+ print(l)
+except RuntimeError:
+ print("RuntimeError")