From: Guido van Rossum [mailto:guido@python.org] > > > This made me realize something. What happens if some sort of > > > exception is raised between 'f1 =3D open()' and the start of the > > > block 'with autoclose(f1):'? > > [...] > > > Please let me know what simple fact I'm missing. > >=20 > > Nothing much, other than the fact that this is an issue with the > > try...except form as well. Basically, this isn't a problem that > > the proposal is trying to solve. > > Actually, I care about this race condition, and for certain situations > I plan to solve it by implementing a bit of magic in C. It would be nice if the "with" statement specification could define the equivalent code and then say "but the with statement is immune to race conditions involving exceptions arriving between the start of the execution of the with expression, and the start of the implied try = block". The implementation of the with statement should copy whatever magic you are going to use. Paul.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4