-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Drop items that can't be serialized. As a part of the python3 conversion, we added logic to try to convert bytestrings to unicode strings. This had a problem because not all bytestrings that are produced as a part of the context passed into and out of the jailed code execution is actually unicode strings. In some cases this was resulting in a unicode decode error. Before this code existed we used to just drop any nonstandard types and also only keep complex types(list,dict,tuples) that were easily jsonable. In python2 this was fine because byte strings would automatically get coerced to unicode strings. However in python3 this will throw errors. So if we don't explicitly try to convert all the byte strings to unicode, we could stop passing back data that we previously used to pass in. The first iteration of this code assumed all byte arrays were unicode strings. From evidence in production this is not always the case. So we fall back to the behaviour we had before this change where if an item can't successfully be converted to something we can serialize to json, we just drop that item from the list of content being passed back through the serialization straw. * Bump the version.
- Loading branch information
Showing
3 changed files
with
107 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters