From 6fe317f2bbf49b05081173d845ebc1179ab8fcb6 Mon Sep 17 00:00:00 2001 From: Ekaterina Tuzova Date: Tue, 28 Jun 2011 17:59:41 +0400 Subject: [PATCH] fixed PY-4020 Byte literal contains characters > 255: gets duplicated on every symbol > 255 --- .../python/inspections/PyByteLiteralInspection.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python/src/com/jetbrains/python/inspections/PyByteLiteralInspection.java b/python/src/com/jetbrains/python/inspections/PyByteLiteralInspection.java index bbf394486fd2..ab1f09a23b8b 100644 --- a/python/src/com/jetbrains/python/inspections/PyByteLiteralInspection.java +++ b/python/src/com/jetbrains/python/inspections/PyByteLiteralInspection.java @@ -44,6 +44,7 @@ public class PyByteLiteralInspection extends PyInspection { !pyfile.hasImportFromFuture(UNICODE_LITERALS) ); } + boolean hasProblem = false; char first_char = Character.toLowerCase(node.getText().charAt(0)); if (first_char == 'b' || (default_bytes && first_char != 'u')) { String value = node.getStringValue(); @@ -51,10 +52,13 @@ public class PyByteLiteralInspection extends PyInspection { for (int i = 0; i < length; ++i) { char c = value.charAt(i); if (((int) c) > 255) { - registerProblem(node, "Byte literal contains characters > 255"); + hasProblem = true; + break; } } } + if (hasProblem) + registerProblem(node, "Byte literal contains characters > 255"); } } }