[New-bugs-announce] [issue33894] tempfile.tempdir cannot be unset

Philip Rowlands report at bugs.python.org
Mon Jun 18 03:34:43 EDT 2018


New submission from Philip Rowlands <pythonbugs at dimebar.com>:

Quoting https://docs.python.org/3/library/tempfile.html
"""
tempfile.tempdir
When set to a value other than None, this variable defines the default value for the dir argument to the functions defined in this module.

If tempdir is unset or None at any call to any of the above functions except gettempprefix() it is initialized following the algorithm described in gettempdir().
"""

"If tempdir is unset ..." is not true:

$ python3 -c 'import tempfile; del tempfile.tempdir; t = tempfile.mkdtemp()'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.2/tempfile.py", line 298, in mkdtemp
    dir = gettempdir()
  File "/usr/lib/python3.2/tempfile.py", line 238, in gettempdir
    if tempdir is None:
NameError: global name 'tempdir' is not defined

No strong preference whether the docs change to match the implementation, or vice-versa.

----------
messages: 319867
nosy: philiprowlands
priority: normal
severity: normal
status: open
title: tempfile.tempdir cannot be unset
type: crash

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33894>
_______________________________________


More information about the New-bugs-announce mailing list