summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorEric L <ericzolf@users.noreply.github.com>2021-03-03 20:36:22 (GMT)
committerGitHub <noreply@github.com>2021-03-03 20:36:22 (GMT)
commit9c7927400cd8f1d283bf7915b6b33fea81b8655d (patch)
treea1cfe04df8fd6569f55d8d352b9c5137563c441d /Misc
parent62e3b6370cf9aa990485d9c7c3ea3f6f150daa47 (diff)
downloadcpython-9c7927400cd8f1d283bf7915b6b33fea81b8655d.zip
cpython-9c7927400cd8f1d283bf7915b6b33fea81b8655d.tar.gz
cpython-9c7927400cd8f1d283bf7915b6b33fea81b8655d.tar.bz2
bpo-40701: tempfile mixes str and bytes in an inconsistent manner (GH-20442)
The case of tempfile.tempdir variable being bytes is now handled consistently. The getters return the right type and no more error of mixing str and bytes unless explicitly caused by the user. Adds a regression test. Expands the documentation to clarify the behavior. Co-authored-by: Eric L <ewl+git@lavar.de> Co-authored-by: Gregory P. Smith <greg@krypto.org>
Diffstat (limited to 'Misc')
-rw-r--r--Misc/NEWS.d/next/Library/2020-05-27-05-42-39.bpo-40701.PBIgW1.rst6
1 files changed, 6 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2020-05-27-05-42-39.bpo-40701.PBIgW1.rst b/Misc/NEWS.d/next/Library/2020-05-27-05-42-39.bpo-40701.PBIgW1.rst
new file mode 100644
index 0000000..a7a4a1c
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-05-27-05-42-39.bpo-40701.PBIgW1.rst
@@ -0,0 +1,6 @@
+When the :data:`tempfile.tempdir` global variable is set to a value of
+type bytes, it is now handled consistently. Previously exceptions
+could be raised from some tempfile APIs when the directory did not
+already exist in this situation. Also ensures that the
+:func:`tempfile.gettempdir()` and :func:`tempfile.gettempdirb()`
+functions *always* return ``str`` and ``bytes`` respectively.