1f = open("io/data/file1")
2
3with f as f2:
4    print(f2.read())
5
6# File should be closed
7try:
8    f.read()
9except:
10    # Note: CPython and us throw different exception trying to read from
11    # close file.
12    print("can't read file after with")
13
14
15# Regression test: test that exception in with initialization properly
16# thrown and doesn't crash.
17try:
18    with open("__non_existent", "r"):
19        pass
20except OSError:
21    print("OSError")
22