New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implicit close() should check for errors #40283
Comments
As we all know, the fileobjects destructor invokes the $ python -c 'open("foo", "w").write("aaa")' No traceback or warning message is printed, but the Another similiar example is: $ python -c 'f=open("foo", "w"); f.write("aaa")' When using an explicit close(), you get a traceback: $ python -c 'f=open("foo", "w"); f.write("aaa"); f.close()'
Traceback (most recent call last):
File "<string>", line 1, in ?
IOError: [Errno 122] Disk quota exceeded I'm aware of that exceptions cannot be raised in |
Logged In: YES I think there are two separate behavior issues: implicit file As I recall, the ref manual says little about the shutdown
Is there already a runtime warning mechanism, or are you |
Logged In: YES It has nothing to do with the interpreter shutdown; the same def foo():
f = open("foo", "w")
f.write("bar")
foo()
time.sleep(1000) |
Logged In: YES I think the issue here is mainly that an explicit file.close() |
Logged In: YES Fixed in revision 2.193 or fileobject.c. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: