Message254377
Maybe the solution is to leave OSError catching after the conditional
(probably with some additional comments):
if not (exist_ok and path.isdir(name)):
try:
mkdir(name, mode)
except OSError as e:
if not exist_ok or e.errno != errno.EEXIST or not path.isdir(name):
raise
This should solve the problem. It also gives more or less guarantee
that errno will be EEXIST, while the current code will also raise an exception
on EROFS (read-only FS), ENOSPC (no space left) in addition to EACCES on Windows
(and possibly some other values on various systems - who knows?). |
|
Date |
User |
Action |
Args |
2015-11-09 10:43:43 | plakhotich | set | recipients:
+ plakhotich, paul.moore, tim.golden, r.david.murray, martin.panter, zach.ware, steve.dower |
2015-11-09 10:43:43 | plakhotich | set | messageid: <1447065823.49.0.931702942151.issue25583@psf.upfronthosting.co.za> |
2015-11-09 10:43:43 | plakhotich | link | issue25583 messages |
2015-11-09 10:43:43 | plakhotich | create | |
|