Fix display of errors in compiled code on Python 3 #1106

Closed
wants to merge 1 commit into
from

2 participants

@takluyver
IPython member

@juliantaylor, I've checked this, and it appears to solve the issue in Python 3.

Closes gh-1100

@minrk minrk commented on the diff Dec 6, 2011
IPython/core/ultratb.py
@@ -879,7 +879,7 @@ def linereader(file=file, lnum=[lnum], getline=linecache.getline):
# enclosing scope.
for token in generate_tokens(linereader):
tokeneater(*token)
- except IndexError:
+ except (IndexError, UnicodeDecodeError):
@minrk
IPython member
minrk added a line comment Dec 6, 2011

Is there any reason this should casta wider net? If not, go ahead and merge.

@takluyver
IPython member
takluyver added a line comment Dec 6, 2011

As far as I know, only these errors can be raised, but it's a part of the machinery I'm not familiar with.

My rationale would be: any other exceptions arising here are likely unusual corner cases, so they shouldn't have a big impact on day-to-day use. On the other hand, they might highlight something we're doing wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@fperez
IPython member

Looks good, merging now with rebase to avoid recursive merge on just one commit.

@fperez
IPython member

Pushed after rebase, closing.

@fperez fperez closed this Dec 6, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment