Correct _mkstemp_inner call on Python < 3.4

This commit is contained in:
Tzu-ping Chung
2018-05-08 17:52:23 +08:00
parent d5d43088ad
commit bc82cb8c09
+2 -1
View File
@@ -8,6 +8,7 @@ import functools
import io
import os
import six
import sys
import warnings
from tempfile import _bin_openflags, gettempdir, _mkstemp_inner, mkdtemp
from .utils import (logging, rmtree)
@@ -257,7 +258,7 @@ def NamedTemporaryFile(
# the file when it is closed. This is only supported by Windows.
if os.name == "nt" and delete:
flags |= os.O_TEMPORARY
if six.PY2:
if sys.version_info < (3, 5):
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
else:
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)