4 ms·
I'm not sure that counts as TOCTOU? What I'm saying is that instead of writing code like: for fname in someglob: if os.path.exists(fname):
by ijustlovemath 2y ago
I'm not sure that counts as TOCTOU?
What I'm saying is that instead of writing code like:
for fname in someglob:
if os.path.exists(fname):
os.unlink(fname)
You should instead write
for fname in someglob:
os.unlink(fname)
and handle the errors.