diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/ConvertFormatOperatorToMethodIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/ConvertFormatOperatorToMethodIntention.java index 8497b223d73b..67323df5896e 100644 --- a/python/src/com/jetbrains/python/codeInsight/intentions/ConvertFormatOperatorToMethodIntention.java +++ b/python/src/com/jetbrains/python/codeInsight/intentions/ConvertFormatOperatorToMethodIntention.java @@ -285,7 +285,9 @@ public class ConvertFormatOperatorToMethodIntention extends PyBaseIntentionActio final PyType rhsType = context.getType(rhs); String prefix = ""; final LanguageLevel languageLevel = guessLanguageLevel(project); - if (!languageLevel.isPy3K() && PyTypeChecker.match(PyBuiltinCache.getInstance(rhs).getObjectType("unicode"), rhsType, context)) { + final PyBuiltinCache builtinCache = PyBuiltinCache.getInstance(rhs); + if (!languageLevel.isPy3K() && PyTypeChecker.match(builtinCache.getUnicodeType(languageLevel), rhsType, context) && + !PyTypeChecker.match(builtinCache.getBytesType(languageLevel), rhsType, context)) { prefix = "u"; } final PyStringLiteralExpression leftExpression = (PyStringLiteralExpression)element.getLeftExpression();