以下は、django のソース コード ( Django-1.41/django/utils/encoding.py
) からのものです。
try:
s = unicode(str(s), encoding, errors)
except UnicodeEncodeError:
if not isinstance(s, Exception):
raise
# If we get to here, the caller has passed in an Exception
# subclass populated with non-ASCII data without special
# handling to display as a string. We need to handle this
# without raising a further exception. We do an
# approximation to what the Exception's standard str()
# output should be.
s = u' '.join([force_unicode(arg, encoding, strings_only,
errors) for arg in s])
私の質問は次のとおりs
です。例外のインスタンスになるのはどの場合ですか?
s が Exception のインスタンスであり、s に str 属性も repr 属性もない場合。この状況よりも。これは正しいですか?