From 072cf022e007e03a8b850a7197585403868923ab Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Fri, 4 Apr 2014 12:14:11 +0300 Subject: [PATCH] tests/file-with: Add testcase which failed for @dpgeorge. Works on x86. --- tests/io/file-with.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/io/file-with.py b/tests/io/file-with.py index 2350721641..ee1e702422 100644 --- a/tests/io/file-with.py +++ b/tests/io/file-with.py @@ -10,3 +10,12 @@ except: # Note: CPython and us throw different exception trying to read from # close file. print("can't read file after with") + + +# Regression test: test that exception in with initialization properly +# thrown and doesn't crash. +try: + with open('__non_existent', 'r'): + pass +except OSError: + print("OSError")