Skip to content

bpo-12611: 2to3 crashes when converting doctest using reduce()#15249

Closed
aldwinaldwin wants to merge 4 commits into
python:mainfrom
aldwinaldwin:2to3doctestreduce
Closed

bpo-12611: 2to3 crashes when converting doctest using reduce()#15249
aldwinaldwin wants to merge 4 commits into
python:mainfrom
aldwinaldwin:2to3doctestreduce

Conversation

@aldwinaldwin

@aldwinaldwin aldwinaldwin commented Aug 13, 2019

Copy link
Copy Markdown
Contributor

Comment thread Lib/lib2to3/refactor.py
new = str(tree).splitlines(keepends=True)
# Adjust lineno for lines inserted before
jmp = 0
for n in new:

@corona10 corona10 Aug 26, 2019

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IMHO
This logic can be replaced by

jmp = max(new.index('\n'), 0)

@@ -0,0 +1 @@
2to3 converting doctest using reduce(). Patch by Aldwin Pollefeyt.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
2to3 converting doctest using reduce(). Patch by Aldwin Pollefeyt.
Fix 2to3 crashing when run on a doctest that uses reduce(). Patch by Aldwin Pollefeyt.

@csabella csabella requested a review from benjaminp February 4, 2020 01:17
@iritkatriel

iritkatriel commented Oct 20, 2021

Copy link
Copy Markdown
Member

Closed under bpo-45544.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants