diff options
| author | cpopa <devnull@localhost> | 2014-06-15 12:07:24 +0300 |
|---|---|---|
| committer | cpopa <devnull@localhost> | 2014-06-15 12:07:24 +0300 |
| commit | 6d01a837357d6c281f30ad30bc6d3183078c3b92 (patch) | |
| tree | 0c29e39ef0b27988b55fe818c3626ed60da97c2f | |
| parent | e7ee2c6c0930701ed6efa7efa9f14ff7764c3de1 (diff) | |
| download | pylint-6d01a837357d6c281f30ad30bc6d3183078c3b92.tar.gz | |
Filter out non-const nodes.
| -rw-r--r-- | checkers/strings.py | 2 | ||||
| -rw-r--r-- | test/input/func_string_format_py27.py | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/checkers/strings.py b/checkers/strings.py index 9be6627..2d8dce6 100644 --- a/checkers/strings.py +++ b/checkers/strings.py @@ -319,6 +319,8 @@ class StringMethodsChecker(BaseChecker): positional, named = get_args(node) except astroid.InferenceError: return + if not isinstance(strnode, astroid.Const): + return try: fields, num_args = parse_format_method_string(strnode.value) except utils.IncompleteFormatString: diff --git a/test/input/func_string_format_py27.py b/test/input/func_string_format_py27.py index a492bb2..458f462 100644 --- a/test/input/func_string_format_py27.py +++ b/test/input/func_string_format_py27.py @@ -69,3 +69,4 @@ def pprint(): print log("{}".format(2, "info"))
print "{pid}".format(pid=os.getpid())
print "{0.missing}".format(2)
+ print str("{}").format(2)
|
