@@ -1094,11 +1094,11 @@ class StringNode(PyConstNode):
...
@@ -1094,11 +1094,11 @@ class StringNode(PyConstNode):
self.check_for_coercion_error(dst_type,fail=True)
self.check_for_coercion_error(dst_type,fail=True)
# this will be a unicode string in Py3, so make sure we can decode it
# this will be a unicode string in Py3, so make sure we can decode it
ifself.value.encoding:
ifself.value.encodingandself.unicode_valueisNone:
encoding=self.value.encoding
encoding=self.value.encoding
try:
try:
self.value.decode(encoding)
self.value.decode(encoding)
exceptUnicodeDecodeError:
except(UnicodeDecodeError,AttributeError):
error(self.pos,"String decoding as '%s' failed. Consider using a byte string or unicode string explicitly, or adjust the source code encoding."%encoding)
error(self.pos,"String decoding as '%s' failed. Consider using a byte string or unicode string explicitly, or adjust the source code encoding."%encoding)