You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Avoid unnecessary copies in snippets for file upload
Prior to this commit, we recommended extracting a string representation
of the uploaded file with:
uploaded_file.tobytes().decode("utf-8")
This causes a copy of the memoryview to be created when it's converted
to bytes. This copy is immediately discarded when it is decoded.
Switching to:
codecs.decode(uploaded_file, encoding="utf-8")
means that we apparently don't create the intermediate copy.
This commit also adds an example of using the uploaded file in an image
widget.
0 commit comments