mirror of
https://github.com/python/cpython.git
synced 2025-08-29 13:15:11 +00:00
Move tempfile over to the io module. Makes test_threaded_import pass.
Thanks Paul Colomiets.
This commit is contained in:
parent
9c121069d3
commit
dd766d53a2
2 changed files with 4 additions and 3 deletions
|
@ -197,7 +197,7 @@ def _get_default_tempdir():
|
||||||
filename = _os.path.join(dir, name)
|
filename = _os.path.join(dir, name)
|
||||||
try:
|
try:
|
||||||
fd = _os.open(filename, flags, 0o600)
|
fd = _os.open(filename, flags, 0o600)
|
||||||
fp = _os.fdopen(fd, 'w')
|
fp = _io.open(fd, 'w')
|
||||||
fp.write('blat')
|
fp.write('blat')
|
||||||
fp.close()
|
fp.close()
|
||||||
_os.unlink(filename)
|
_os.unlink(filename)
|
||||||
|
@ -438,7 +438,7 @@ def NamedTemporaryFile(mode='w+b', bufsize=-1, suffix="",
|
||||||
flags |= _os.O_TEMPORARY
|
flags |= _os.O_TEMPORARY
|
||||||
|
|
||||||
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
|
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
|
||||||
file = _os.fdopen(fd, mode, bufsize)
|
file = _io.open(fd, mode, bufsize)
|
||||||
return _TemporaryFileWrapper(file, name, delete)
|
return _TemporaryFileWrapper(file, name, delete)
|
||||||
|
|
||||||
if _os.name != 'posix' or _os.sys.platform == 'cygwin':
|
if _os.name != 'posix' or _os.sys.platform == 'cygwin':
|
||||||
|
@ -471,7 +471,7 @@ else:
|
||||||
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
|
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
|
||||||
try:
|
try:
|
||||||
_os.unlink(name)
|
_os.unlink(name)
|
||||||
return _os.fdopen(fd, mode, bufsize)
|
return _io.open(fd, mode, bufsize)
|
||||||
except:
|
except:
|
||||||
_os.close(fd)
|
_os.close(fd)
|
||||||
raise
|
raise
|
||||||
|
|
|
@ -134,6 +134,7 @@ Josh Cogliati
|
||||||
Dave Cole
|
Dave Cole
|
||||||
Benjamin Collar
|
Benjamin Collar
|
||||||
Jeffery Collins
|
Jeffery Collins
|
||||||
|
Paul Colomiets
|
||||||
Matt Conway
|
Matt Conway
|
||||||
David M. Cooke
|
David M. Cooke
|
||||||
Greg Copeland
|
Greg Copeland
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue