Message282403
Can the _mkstemp_inner portion of Billy McCulloch's patch be applied? Due to a large default os.TMP_MAX value (2147483647 - seems to be the current value on Win 7/8.1/10 I have access to), the following will push the CPU to 100% for a very long time when run under a non-elevated shell:
--
import tempfile
tempfile.TemporaryFile(dir='C:\Windows')
... wait ...
--
In _mkstemp_inner() we should be testing for the filename, not parent directory here:
except PermissionError:
# This exception is thrown when a directory with the chosen name
# already exists on windows.
if (_os.name == 'nt' and _os.path.isdir(dir) and
_os.access(dir, _os.W_OK)):
continue
Changing the _os.path.isdir(dir) call to _os.path.isdir(filename) is all that is needed to prevent the death loop and function correctly in cases where Windows os.access(dir, _os.W_OK) claims we have write access when we do not. |
|
Date |
User |
Action |
Args |
2016-12-05 09:49:20 | Paul Doom | set | recipients:
+ Paul Doom, georg.brandl, paul.moore, ncoghlan, rupole, tim.golden, python-dev, takluyver, zach.ware, serhiy.storchaka, eryksun, steve.dower, Billy McCulloch |
2016-12-05 09:49:20 | Paul Doom | set | messageid: <1480931360.01.0.64800983749.issue22107@psf.upfronthosting.co.za> |
2016-12-05 09:49:19 | Paul Doom | link | issue22107 messages |
2016-12-05 09:49:19 | Paul Doom | create | |
|