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

wants to merge 1 commit into


None yet

3 participants


@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
@@ -879,7 +879,7 @@ def linereader(file=file, lnum=[lnum], getline=linecache.getline):
# enclosing scope.
for token in generate_tokens(linereader):
- except IndexError:
+ except (IndexError, UnicodeDecodeError):
minrk Dec 6, 2011 Member

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

takluyver Dec 6, 2011 Member

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.

fperez commented Dec 6, 2011

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

fperez commented Dec 6, 2011

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