Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more general fix for #662 #1472

Merged
merged 2 commits into from Mar 13, 2012
Merged

more general fix for #662 #1472

merged 2 commits into from Mar 13, 2012

Conversation

minrk
Copy link
Member

@minrk minrk commented Mar 5, 2012

Previously, the extra readline output was only stripped from the front, but I have recently seen it (Python 3.2, OSX 10.7) elsewhere, so the replacement is now a general re.sub.

Previously, the extra readline output was only stripped from the
front, but I have recently seen it (Python 3.2, OSX 10.7) elsewhere,
so the replacement is now a general `re.sub`.
@@ -217,16 +217,12 @@ def ipexec(fname, options=None):
full_cmd = '%s %s %s' % (ipython_cmd, cmdargs, full_fname)
#print >> sys.stderr, 'FULL CMD:', full_cmd # dbg
out = getoutputerror(full_cmd)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the code would be tidier if we unpack out, err here, and then repack them at the return statement. That way, out is always a string, rather than swapping between being a tuple and a string.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, and I checked getoutputerror, which now guarantees it will return a tuple of strings (apparently it used to return either a tuple of strings or None). That makes this code a good deal simpler.

@takluyver
Copy link
Member

Apart from that minor point, I think this looks OK. I assume that no sequence matching r'\x1b\[[^h]+h' will ever occur as part of the output that we want.

Code reflected the possibility that getoutputerror could return None,
but this is no longer the case.  It always returns two strings.
@takluyver
Copy link
Member

OK, that looks good to me.

minrk added a commit that referenced this pull request Mar 13, 2012
more general fix for #662

Previously, the extra readline output was only stripped from the front, but I have recently seen it (Python 3.2, OSX 10.7) elsewhere, so the replacement is now a general re.sub.
@minrk minrk merged commit 3912ea7 into ipython:master Mar 13, 2012
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
more general fix for ipython#662

Previously, the extra readline output was only stripped from the front, but I have recently seen it (Python 3.2, OSX 10.7) elsewhere, so the replacement is now a general re.sub.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants