From 6ded55a61f6bbf007d518fc4531287de08fe51c4 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Mon, 31 Mar 2014 02:20:00 +0300 Subject: py: Properly implement divide-by-zero handling. "1/0" is sacred idiom, the shortest way to break program execution (sys.exit() is too long). --- tests/basics/int-divzero.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 tests/basics/int-divzero.py (limited to 'tests/basics/int-divzero.py') diff --git a/tests/basics/int-divzero.py b/tests/basics/int-divzero.py new file mode 100644 index 0000000000..d1fc579321 --- /dev/null +++ b/tests/basics/int-divzero.py @@ -0,0 +1,9 @@ +try: + 1 / 0 +except ZeroDivisionError: + print("ZeroDivisionError") + +try: + 1 // 0 +except ZeroDivisionError: + print("ZeroDivisionError") -- cgit v1.2.3