summaryrefslogtreecommitdiff
path: root/checkers
diff options
context:
space:
mode:
authorcpopa <devnull@localhost>2014-06-16 22:57:57 +0300
committercpopa <devnull@localhost>2014-06-16 22:57:57 +0300
commitc5e05b7c2e3079250a5e3b274b34aec5bf4c2aa9 (patch)
tree42ba89afbccd69a2d52779b82d7bdace9a3ec526 /checkers
parentc86f5196aa899651dbf6667e86c7d3112def7159 (diff)
downloadpylint-c5e05b7c2e3079250a5e3b274b34aec5bf4c2aa9.tar.gz
Don't warn with 'bad-format-character' when encountering the 'a' format on Python 3.
Diffstat (limited to 'checkers')
-rw-r--r--checkers/utils.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/checkers/utils.py b/checkers/utils.py
index e7d85d4..6f40538 100644
--- a/checkers/utils.py
+++ b/checkers/utils.py
@@ -19,6 +19,7 @@
"""
import re
+import sys
import string
import astroid
@@ -28,6 +29,7 @@ from logilab.common.compat import builtins
BUILTINS_NAME = builtins.__name__
COMP_NODE_TYPES = astroid.ListComp, astroid.SetComp, astroid.DictComp, astroid.GenExpr
+PY3K = sys.version_info[0] == 3
class NoSuchArgumentError(Exception):
@@ -345,7 +347,11 @@ def parse_format_string(format_string):
if char in 'hlL':
i, char = next_char(i)
# Parse the conversion type (mandatory).
- if char not in 'diouxXeEfFgGcrs%':
+ if PY3K:
+ flags = 'diouxXeEfFgGcrs%a'
+ else:
+ flags = 'diouxXeEfFgGcrs%'
+ if char not in flags:
raise UnsupportedFormatCharacter(i)
if key:
keys.add(key)