##// END OF EJS Templates
IPython/utils/io.py: Make sure `devnull` is closed at exit to avoid a `ResourceWarning` being raised by Python 3.
John Kirkham -
Show More
@@ -10,6 +10,7 b' from __future__ import print_function'
10 from __future__ import absolute_import
10 from __future__ import absolute_import
11
11
12
12
13 import atexit
13 import os
14 import os
14 import sys
15 import sys
15 import tempfile
16 import tempfile
@@ -73,6 +74,7 b' class IOStream:'
73
74
74 # setup stdin/stdout/stderr to sys.stdin/sys.stdout/sys.stderr
75 # setup stdin/stdout/stderr to sys.stdin/sys.stdout/sys.stderr
75 devnull = open(os.devnull, 'w')
76 devnull = open(os.devnull, 'w')
77 atexit.register(devnull.close)
76 stdin = IOStream(sys.stdin, fallback=devnull)
78 stdin = IOStream(sys.stdin, fallback=devnull)
77 stdout = IOStream(sys.stdout, fallback=devnull)
79 stdout = IOStream(sys.stdout, fallback=devnull)
78 stderr = IOStream(sys.stderr, fallback=devnull)
80 stderr = IOStream(sys.stderr, fallback=devnull)
General Comments 0
You need to be logged in to leave comments. Login now