##// END OF EJS Templates
Merge pull request #5222 from takluyver/i5218...
Min RK -
r15470:3647c1e0 merge
parent child Browse files
Show More
@@ -120,8 +120,8 b' def get_encoding(obj):'
120 # Print only text files, not extension binaries. Note that
120 # Print only text files, not extension binaries. Note that
121 # getsourcelines returns lineno with 1-offset and page() uses
121 # getsourcelines returns lineno with 1-offset and page() uses
122 # 0-offset, so we must adjust.
122 # 0-offset, so we must adjust.
123 buffer = stdlib_io.open(ofile, 'rb') # Tweaked to use io.open for Python 2
123 with stdlib_io.open(ofile, 'rb') as buffer: # Tweaked to use io.open for Python 2
124 encoding, lines = openpy.detect_encoding(buffer.readline)
124 encoding, lines = openpy.detect_encoding(buffer.readline)
125 return encoding
125 return encoding
126
126
127 def getdoc(obj):
127 def getdoc(obj):
@@ -213,7 +213,9 b' def ipexec(fname, options=None):'
213 # Absolute path for filename
213 # Absolute path for filename
214 full_fname = os.path.join(test_dir, fname)
214 full_fname = os.path.join(test_dir, fname)
215 full_cmd = ipython_cmd + cmdargs + [full_fname]
215 full_cmd = ipython_cmd + cmdargs + [full_fname]
216 p = Popen(full_cmd, stdout=PIPE, stderr=PIPE)
216 env = os.environ.copy()
217 env.pop('PYTHONWARNINGS', None) # Avoid extraneous warnings appearing on stderr
218 p = Popen(full_cmd, stdout=PIPE, stderr=PIPE, env=env)
217 out, err = p.communicate()
219 out, err = p.communicate()
218 out, err = py3compat.bytes_to_str(out), py3compat.bytes_to_str(err)
220 out, err = py3compat.bytes_to_str(out), py3compat.bytes_to_str(err)
219 # `import readline` causes 'ESC[?1034h' to be output sometimes,
221 # `import readline` causes 'ESC[?1034h' to be output sometimes,
General Comments 0
You need to be logged in to leave comments. Login now