From 26db023a9c03566dd340e5d3fcd63681768c4e0b Mon Sep 17 00:00:00 2001 From: Valentina Kiryushkina Date: Fri, 24 Jun 2016 18:58:37 +0300 Subject: [PATCH] Fix PY-19699 False positive "Too few arguments for format string" on *imported* tuple: don't inspect expression with not-inferred type --- .../jetbrains/python/inspections/PyStringFormatInspection.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/src/com/jetbrains/python/inspections/PyStringFormatInspection.java b/python/src/com/jetbrains/python/inspections/PyStringFormatInspection.java index a2be27d5ef7c..f02ed70a8660 100644 --- a/python/src/com/jetbrains/python/inspections/PyStringFormatInspection.java +++ b/python/src/com/jetbrains/python/inspections/PyStringFormatInspection.java @@ -219,7 +219,8 @@ public class PyStringFormatInspection extends PyInspection { final PyType stringType = PyBuiltinCache.getInstance(rightExpression).getStringType(LanguageLevel.forElement(rightExpression)); final PyType listType = PyBuiltinCache.getInstance(rightExpression).getListType(); - if (type == null || PyTypeChecker.match(listType, type, myTypeEvalContext) + if (type == null) return -1; + if (PyTypeChecker.match(listType, type, myTypeEvalContext) || PyTypeChecker.match(stringType, type, myTypeEvalContext)) { checkTypeCompatible(problemTarget, builtinCache.getStrType(), PyTypeParser.getTypeByName(problemTarget, s));