summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2019-08-27 19:49:45 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2019-08-27 19:49:45 +0000
commite5ab0e0c60c7375a7a17555c66ba0ce178bb6b8c (patch)
tree9eeeba6c3860909eece6dc8413b4ce2c9450be53
parentfeb6d8044260128c9c08a52b5e636788c0c6285a (diff)
downloaddocutils-e5ab0e0c60c7375a7a17555c66ba0ce178bb6b8c.tar.gz
trivial: Set 'ListTable.check_list_content.num_cols' always
Rather than having a TODO that tells users that this attribute is always set in a given loop, just set it at the top. Much simpler. Signed-off-by: Stephen Finucane <stephen@that.guru> git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8377 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
-rw-r--r--docutils/docutils/parsers/rst/directives/tables.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/docutils/docutils/parsers/rst/directives/tables.py b/docutils/docutils/parsers/rst/directives/tables.py
index 294e7b762..e13ddc9f4 100644
--- a/docutils/docutils/parsers/rst/directives/tables.py
+++ b/docutils/docutils/parsers/rst/directives/tables.py
@@ -451,6 +451,7 @@ class ListTable(Table):
line=self.lineno)
raise SystemMessagePropagation(error)
list_node = node[0]
+ num_cols = 0
# Check for a uniform two-level bullet list:
for item_index in range(len(list_node)):
item = list_node[item_index]
@@ -463,9 +464,6 @@ class ListTable(Table):
self.block_text, self.block_text), line=self.lineno)
raise SystemMessagePropagation(error)
elif item_index:
- # ATTN pychecker users: num_cols is guaranteed to be set in the
- # "else" clause below for item_index==0, before this branch is
- # triggered.
if len(item[0]) != num_cols:
error = self.state_machine.reporter.error(
'Error parsing content block for the "%s" directive: '