fixed PY-4020 Byte literal contains characters > 255: gets duplicated on every symbol > 255

This commit is contained in:
Ekaterina Tuzova
2011-06-28 17:59:41 +04:00
parent 08ea6dc0a4
commit 6fe317f2bb
@@ -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");
}
}
}