Issue30265
Created on 2017-05-04 00:03 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 1456 | merged | vstinner, 2017-05-04 15:02 | |
| Messages (5) | |||
|---|---|---|---|
| msg292949 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2017-05-04 00:03 | |
While working on issue #30264, I noticed that test.support.unlink() ignores *all* OSError exceptions. I suggest to add handle WindowsError: [Error 32] differently. Example of such error, issue #15388: WindowsError: [Error 32] The process cannot access the file because it is being used by another process: I suggest to either raise an exception (passthrough the original OSError), or emit/log a warning. |
|||
| msg292980 - (view) | Author: Jeremy Kloth (jkloth) * | Date: 2017-05-04 13:55 | |
Looking at test.support, the only errors that I can see being ignored by unlink() is FileNotFoundError and NotADirectoryError (line 399). The only bare OSError except clause is on line 359, but for an lstat() call. |
|||
| msg292982 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2017-05-04 13:58 | |
> Looking at test.support, the only errors that I can see being ignored by unlink() is FileNotFoundError and NotADirectoryError (line 399)
Oh wait, I was looking at Python 2.7 code:
def unlink(filename):
try:
_unlink(filename)
except OSError:
pass
So this issuse seems to be specific to Python 2.7.
|
|||
| msg293076 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2017-05-05 08:27 | |
New changeset 03b278895fa0db355af4e450eac71dd0532db394 by Victor Stinner in branch '2.7': bpo-30265: support.unlink() don't catch any OSError (#1456) https://github.com/python/cpython/commit/03b278895fa0db355af4e450eac71dd0532db394 |
|||
| msg293077 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2017-05-05 08:28 | |
Ok, fixed. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:46 | admin | set | github: 74451 |
| 2017-05-05 08:28:25 | vstinner | set | status: open -> closed resolution: fixed messages: + msg293077 stage: resolved |
| 2017-05-05 08:27:36 | vstinner | set | messages: + msg293076 |
| 2017-05-04 15:02:04 | vstinner | set | pull_requests: + pull_request1554 |
| 2017-05-04 13:58:10 | vstinner | set | title: test.support.unlink() should fail or emit a warning on WindowsError: [Error 32] The process cannot access the file ... -> [2.7] test.support.unlink() should fail or emit a warning on WindowsError: [Error 32] The process cannot access the file ... messages: + msg292982 versions: + Python 2.7, - Python 3.7 |
| 2017-05-04 13:55:25 | jkloth | set | nosy:
+ jkloth messages: + msg292980 |
| 2017-05-04 00:03:15 | vstinner | create | |
