circuitpython/tests/misc/recursive_data.py_
Paul Sokolovsky 8993fb6cf0 py: Add protection against printing too nested or recursive data structures.
With a test which cannot be automatically validated so far.
2014-06-28 02:25:04 +03:00

10 lines
330 B
Plaintext

# 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")