R. David Murray added the comment:
Yes, it is intended behavior, and it is documented. The default mode for
NamedTemporaryFile (and TemporaryFile) is shown in the docs as "w+b".
I suppose that used to be more convenient in python2 where there was almost no
distinction between binary and text
New submission from Kevin Bonham:
Python 3.6.0 (default, Dec 24 2016, 08:01:42)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from tempfile import NamedTemporaryFile
>>> tmp = NamedTemporaryFile()
>