[3.8] bpo-37421: test_winconsoleio doesn't leak temp file anymore (GH-14562) by miss-islington · Pull Request #14569 · python/cpython
fd, _ = tempfile.mkstemp() try: with tempfile.TemporaryFile() as tmpfile: fd = tmpfile.fileno() # Windows 10: "Cannot open non-console file" # Earlier: "Cannot open console output buffer for reading" self.assertRaisesRegex(ValueError, "Cannot open (console|non-console file)", ConIO, fd) finally: os.close(fd)
try: f = ConIO(0)