Author jwilk
Recipients jwilk, ncoghlan, rhettinger
Date 2018-07-20.13:49:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1532094592.85.0.56676864532.issue34157@psf.upfronthosting.co.za>
In-reply-to
Content
I think issue29988 is unrelated, or at least not the whole story.

These are samples of tracebacks I see when the file is left behind:

  Traceback (most recent call last):
    File "test-tmpfile.py", line 4, in <module>
      with tempfile.NamedTemporaryFile(dir='.'):
    File "/opt/python/lib/python3.8/tempfile.py", line 548, in NamedTemporaryFile
      (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
    File "/opt/python/lib/python3.8/tempfile.py", line 258, in _mkstemp_inner
      fd = _os.open(file, flags, 0o600)
  KeyboardInterrupt
  
  Traceback (most recent call last):
    File "test-tmpfile.py", line 4, in <module>
      with tempfile.NamedTemporaryFile(dir='.'):
    File "/opt/python/lib/python3.8/tempfile.py", line 548, in NamedTemporaryFile
      (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
    File "/opt/python/lib/python3.8/tempfile.py", line 269, in _mkstemp_inner
      return (fd, _os.path.abspath(file))
    File "/opt/python/lib/python3.8/posixpath.py", line 371, in abspath
      path = os.fspath(path)
  KeyboardInterrupt
  
  Traceback (most recent call last):
    File "test-tmpfile.py", line 4, in <module>
      with tempfile.NamedTemporaryFile(dir='.'):
    File "/opt/python/lib/python3.8/tempfile.py", line 548, in NamedTemporaryFile
      (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
    File "/opt/python/lib/python3.8/tempfile.py", line 269, in _mkstemp_inner
      return (fd, _os.path.abspath(file))
    File "/opt/python/lib/python3.8/posixpath.py", line 378, in abspath
      return normpath(path)
    File "/opt/python/lib/python3.8/posixpath.py", line 355, in normpath
      if comp in (empty, dot):
  KeyboardInterrupt

In all cases the interrupt happened in the NamedTemporaryFile function,
so before __enter__/__exit__ would have chance to do its job.
History
Date User Action Args
2018-07-20 13:49:52jwilksetrecipients: + jwilk, rhettinger, ncoghlan
2018-07-20 13:49:52jwilksetmessageid: <1532094592.85.0.56676864532.issue34157@psf.upfronthosting.co.za>
2018-07-20 13:49:52jwilklinkissue34157 messages
2018-07-20 13:49:52jwilkcreate