I've just observed that the following little Python 3.8 program
import pickle
with open(False, "rb") as file:
print("Inside context block")
o = pickle.load(file)
print("Out of the context block")
outputs Inside context block
and freezes at pickle.load
.
Shouldn't
open
fail and raise an exception in this case?Shouldn't
pickle.load
fail and raise an exception in this case?