Skip to content

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

Closed
aldwinaldwin wants to merge 4 commits intopython:mainfrom
aldwinaldwin:2to3doctestreduce
Closed

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

Conversation

@aldwinaldwin
Copy link
Contributor

@aldwinaldwin aldwinaldwin commented Aug 13, 2019

new = str(tree).splitlines(keepends=True)
# Adjust lineno for lines inserted before
jmp = 0
for n in new:
Copy link
Member

@corona10 corona10 Aug 26, 2019

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
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
Copy link
Member

iritkatriel commented Oct 20, 2021

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