Patchwork [4,of,8,py3] minirst: look for column delimiters using slices instead of indicies

login
register
mail settings
Submitter Augie Fackler
Date May 28, 2017, 8:59 p.m.
Message ID <c5c6c6d5182249fe4ec6.1496005140@imladris.local>
Download mbox | patch
Permalink /patch/21000/
State Accepted
Headers show

Comments

Augie Fackler - May 28, 2017, 8:59 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1496000863 14400
#      Sun May 28 15:47:43 2017 -0400
# Node ID c5c6c6d5182249fe4ec6daa7ff2e0faf1a3a7e75
# Parent  90be401bce985bff41ccb8f1ed463329ff629ca8
minirst: look for column delimiters using slices instead of indicies

This works on both Python 2 and 3.

Patch

diff --git a/mercurial/minirst.py b/mercurial/minirst.py
--- a/mercurial/minirst.py
+++ b/mercurial/minirst.py
@@ -315,7 +315,8 @@  def findtables(blocks):
             # column markers are ASCII so we can calculate column
             # position in bytes
             columns = [x for x in xrange(len(div))
-                       if div[x] == '=' and (x == 0 or div[x - 1] == ' ')]
+                       if div[x:x + 1] == '=' and (x == 0 or
+                                                   div[x - 1:x] == ' ')]
             rows = []
             for l in block['lines'][1:-1]:
                 if l == div: