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

Compatibility with IPython 8 where tracebacks are different #190

Merged
merged 1 commit into from
Jan 5, 2022

Conversation

frenzymadness
Copy link
Contributor

Fixed #189

We cannot use different regex for different IPython versions because the testing files contain the old form so we have to use them both. All tests are passing now with IPython 8.

Comment on lines +207 to +211
tb = []
for line in output["traceback"]:
line = re.sub(ipython_input_pat, '<IPY-INPUT>', strip_ansi(line))
line = re.sub(ipython8_input_pat, '<IPY-INPUT>', strip_ansi(line))
tb.append(line)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
tb = []
for line in output["traceback"]:
line = re.sub(ipython_input_pat, '<IPY-INPUT>', strip_ansi(line))
line = re.sub(ipython8_input_pat, '<IPY-INPUT>', strip_ansi(line))
tb.append(line)
tb = [
re.sub(ipython8_input_pat, '<IPY-INPUT>', strip_ansi(
re.sub(ipython_input_pat, '<IPY-INPUT>', strip_ansi(line))
)
for line in output['traceback']
]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, honestly, my implementation seems to be more readable to me but it's your codebase so, if you want to, apply this suggestion. It might be also possible to merge the two regexes to one but again, readability would suffer.

Copy link
Member

Choose a reason for hiding this comment

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

It was just a suggestion, I have no strong preference.

@davidbrochart davidbrochart merged commit 23f07eb into jupyter:master Jan 5, 2022
@davidbrochart
Copy link
Member

Thanks!

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.

Compatibility with IPython 8 beta
2 participants