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 Antony.Lee
Recipients Antony.Lee, georg.brandl, ncoghlan, serhiy.storchaka, yselivanov
Date 2014-09-26.21:35:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1411767320.37.0.80121768997.issue20267@psf.upfronthosting.co.za>
In-reply-to
Content
This looks reasonable.  Note that the output of gettempdir is always passed as first argument to os.path.join (possibly via _mkstemp_inner), so perhaps you should rather define something like

def _absolute_child_of_parent_or_tmpdir(parent, *args):
    """Return the absolute child of parent, or gettempdir() if parent is None, given by *args.
    """
    if parent is None:
        parent = <_sanitize_dir> # inline the code here
    return _os.path.join(parent, *args)

and use that function instead.

This factorizes the code a little bit more and makes intent clearer (I don't think _sanitize_dir is a very clear name).
History
Date User Action Args
2014-09-26 21:35:20Antony.Leesetrecipients: + Antony.Lee, georg.brandl, ncoghlan, serhiy.storchaka, yselivanov
2014-09-26 21:35:20Antony.Leesetmessageid: <1411767320.37.0.80121768997.issue20267@psf.upfronthosting.co.za>
2014-09-26 21:35:20Antony.Leelinkissue20267 messages
2014-09-26 21:35:20Antony.Leecreate