Eric L. <ewl+pyt...@lavar.de> added the comment:
In the meantime, I noticed the following in addition: [ericl@tuxedo ~]$ python3.9 Python 3.9.0a6 (default, Apr 28 2020, 00:00:00) [GCC 10.0.1 20200430 (Red Hat 10.0.1-0.14)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import tempfile >>> tempfile.tempdir = b'/tmp' >>> tempfile.gettempdir() b'/tmp' >>> tempfile.tempdir = '/tmp' >>> tempfile.gettempdirb() b'/tmp' This actually explicitly hurts the interface description which states that tempfile.gettempdir() returns a string. "Encouraged" by this discovery, I've tried to write a patch of tempfile.py addressing the issues discovered. It's my first patch ever of Python so bare with me. The default remains string but if someone _explicitly_ sets tempdir to bytes, it'll become bytes. I've tried all the commands listed previously and it all looks consistent to me. ---------- keywords: +patch Added file: https://bugs.python.org/file49176/tempfile.py.diff _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40701> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com