◐ Shell
clean mode source ↗

bpo-12611: 2to3 crashes when converting doctest using reduce() by aldwinaldwin · Pull Request #15249 · python/cpython

corona10

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

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)

epicfaace

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

Choose a reason for hiding this comment

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

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

@iritkatriel