This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients giampaolo.rodola, ijmorlan, terry.reedy, ysj.ray
Date 2010-07-19.16:03:11
SpamBayes Score 4.252803e-06
Marked as misclassified No
Message-id <1279555394.45.0.545906477739.issue9299@psf.upfronthosting.co.za>
In-reply-to
Content
Since this is a library issue, it can go into 3.2.
It is definitely a feature request, hence not in 2.7. Code that depends on the exception suppression would crash on an earlier release.

http://mail.python.org/pipermail/python-dev/2010-July/102027.html
Guido said "Well, it really should have behaved like mkdir -p in the first place.", so this is accepted pending patch approval.

The patch includes doc, test, and code patches.

The name 'ensure_exist' for the new parameter strikes me as wrong, as well as too long for something that will nearly always be set to True. The function always ensures that the directory exists. The question is whether it is ok that it exist previously. I strongly suggest something shorter like 'exist_ok' as an alternative.

The name 'excl' used in #

The code looks OK as far as I can read it, but someone else should look at the C code for posimodule-mkdir.

Does the use of 'base = support.TESTFN' ensure that the test junk gets cleaned up?

This versus #1675: the presenting issues are different -- parent race condition leading to error versus leaf existence leading to error. However, the patches are nearly the same and would have much the same effect. The differences:

* Test: 1675 lacks a new test; there should be one.

* New parameter name: they use different names, I do not like either. They use opposite senses -- exist_ok versus exist_bad for the new parameter. I think a good name is more important.

* Location of error suppression: this patches posixfile.mkdir; 1675 wraps it with a new os.mkdir function that does the suppression. I can see an argument for each approach. 

* Propagation to parent directories: this passes exist_ok to parent mkdir(); 1675 passes exist_ok=True, so that it is never an error for parent directories to exist. This is a change in behavior and might be bad for the same reason we do not make exist_ok=True the default. In any case, I believe either patch could be changed to mimic the other.

Thus there are three choices to make before committing.
History
Date User Action Args
2010-07-19 16:03:14terry.reedysetrecipients: + terry.reedy, giampaolo.rodola, ijmorlan, ysj.ray
2010-07-19 16:03:14terry.reedysetmessageid: <1279555394.45.0.545906477739.issue9299@psf.upfronthosting.co.za>
2010-07-19 16:03:13terry.reedylinkissue9299 messages
2010-07-19 16:03:11terry.reedycreate