Catch only UnicodeError for string decode failure.
The default exception (which we use) for decode failures is UnicodeError or a subclass of it. This fixes a unittest that forces RuntimeError. We shouldn't use blanket except blocks either way.
This commit is contained in:
parent
afe6c518c3
commit
8021c75932
@ -87,7 +87,7 @@ def _make_c_string(string, check_null=False):
|
||||
try:
|
||||
string.decode("utf-8")
|
||||
return string + "\x00"
|
||||
except:
|
||||
except UnicodeError:
|
||||
raise InvalidStringData("strings in documents must be valid "
|
||||
"UTF-8: %r" % string)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user