Better testing of named %c format specifiers

This commit is contained in:
rocky 2018-05-08 08:49:43 -04:00
parent 15533c5e38
commit e76f1f107f
3 changed files with 12 additions and 7 deletions

View File

@ -1,5 +1,5 @@
#!/bin/bash
PYTHON_VERSION=3.6.4
PYTHON_VERSION=3.6.5
# FIXME put some of the below in a common routine
function finish {

View File

@ -1620,12 +1620,14 @@ class FragmentsWalker(pysource.SourceWalker, object):
index = entry[arg]
if isinstance(index, tuple):
assert node[index[0]] == index[1], (
"at %s[%d], %s vs %s" % (
"at %s[%d], expected %s node; got %s" % (
node.kind, arg, node[index[0]].kind, index[1])
)
index = index[0]
if isinstance(index, int):
self.preorder(node[index])
assert isinstance(index, int), (
"at %s[%d], %s should be int or tuple" % (
node.kind, arg, type(index)))
self.preorder(node[index])
finish = len(self.f.getvalue())
self.set_pos_info(node, start, finish)

View File

@ -1744,12 +1744,15 @@ class SourceWalker(GenericASTTraversal, object):
index = entry[arg]
if isinstance(index, tuple):
assert node[index[0]] == index[1], (
"at %s[%d], %s vs %s" % (
"at %s[%d], expected %s node; got %s" % (
node.kind, arg, node[index[0]].kind, index[1])
)
index = index[0]
if isinstance(index, int):
self.preorder(node[index])
assert isinstance(index, int), (
"at %s[%d], %s should be int or tuple" % (
node.kind, arg, type(index)))
self.preorder(node[index])
arg += 1
elif typ == 'p':
p = self.prec