[issue20267] TemporaryDirectory does not resolve path when created using a relative path
Antony Lee
report at bugs.python.org
Fri Sep 26 23:35:20 CEST 2014
Antony Lee added the comment:
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).
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20267>
_______________________________________
More information about the Python-bugs-list
mailing list