From 8993fb6cf0677ce980ab56cbad326e4e6bc47811 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 28 Jun 2014 02:25:04 +0300 Subject: py: Add protection against printing too nested or recursive data structures. With a test which cannot be automatically validated so far. --- tests/misc/recursive_data.py_ | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 tests/misc/recursive_data.py_ (limited to 'tests/misc') diff --git a/tests/misc/recursive_data.py_ b/tests/misc/recursive_data.py_ new file mode 100644 index 000000000..6a52a3c0e --- /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") -- cgit v1.2.3