os.remove might throw an exception (of type OSError), if given file
doesn't exist. Catch the exception, and ignore it iff errno is
ENOENT. Rethrow the exception, if errno is not ENOENT.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
scripts/Python/buildSwigPython.py | ||
---|---|---|
686–687 ↗ | (On Diff #16507) | Do we not have the same issue here? |
scripts/Python/buildSwigPython.py | ||
---|---|---|
686–687 ↗ | (On Diff #16507) | Presumably, yes. I wasn't trying with LLDB_DISABLE_PYTHON, but with CMake generated Xcode project on Darwin, and region below failed. I didn't examine all instances of os.remove, I guess I should have. How about: def removeignoreenoent(filename): try: os.remove(filename) except OSError as e: import errno if e.errno != errno.ENOENT: raise pass and call this function instead of os.remove. We might use a better/shorter name; any suggestions? |
scripts/Python/buildSwigPython.py | ||
---|---|---|
435 ↗ | (On Diff #16515) | Please add underscores between the words, to be consistent with the naming convention used elsewhere in this function. |
Comment Actions
Looks fine with a couple of minor comments.
scripts/Python/buildSwigPython.py | ||
---|---|---|
431–433 ↗ | (On Diff #16518) | This comment seems overly verbose -- it's clear from reading the function that this is what happens. What about something succinct like "Remove a file, ignoring error if it does not exist." |
604 ↗ | (On Diff #16518) | random whitespace change |