New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
don't 'restore_bytes' in from_JSON #4043
Conversation
Things we need to be careful about (and fully document). With this change, the nbformat clearly asserts that:
We were already doing this, but the data types we used did not reflect that, because we were ensuring that we had base64-encoded bytes, which doesn't make any sense to me. Pinging @ellisonbg for careful review. |
Note that this actually didn't fail, it just managed to run tests on 2.6 after we merged @takluyver's drop-2.6 PR. |
rebased, let's see if it passes now. |
+1 |
@ellisonbg , I think this is on your pile for review. I've assigned it to you. |
OK I will review this... |
it makes no sense to turn base64-encoded unicode strings into base64-encoded byte strings. I can't think why we do this, but we should be very careful about testing before merging this fix. fixes the issue tested in ipython#4036.
I will merge this in the next day or two if I don't hear from anyone. |
todo:
|
data is coerced to unicode (cast with 'replace', so no errors)
both cases are tested - they pass through without errors, because data is coerced to unicode (unrecognized characters are replaced with �). If we want to raise an exception on bad data, I can change that, too. |
This looks great, I am +1 on merging, but I will let you do that. |
don't 'restore_bytes' in from_JSON It makes no sense to coerce base64-encoded unicode strings into base64-encoded byte strings. closes #4036
It makes no sense to turn base64-encoded unicode strings into base64-encoded byte strings. I can't think why we do this, but we should be very careful about testing before merging this fix. fixes the issue tested in #4036.
* commit 'rel-1.1.0-3-gb8b89ca': (66 commits) Backport PR ipython#4209: Magic doc fixes Backport PR ipython#4204: remove some extraneous print statements from IPython.parallel back to dev release 1.1.0 don't upload to GitHub in release script 1.1 backport stats Backport PR ipython#4188: Allow user_ns trait to be None Backport PR ipython#4189: always fire LOCAL_IPS.extend(PUBLIC_IPS) Backport PR ipython#4174: various issues in markdown and rst templates Backport PR ipython#4181: nbconvert: Fix, sphinx template not removing new lines from headers Backport PR ipython#4043: don't 'restore_bytes' in from_JSON Backport PR ipython#4178: add missing data_javascript Backport PR ipython#4136: catch javascript errors in any output Backport PR ipython#4163: Fix for incorrect default encoding on Windows. Backport PR ipython#4171: add nbconvert config file when creating profiles Backport PR ipython#4159: don't split `.cell` and `div.cell` CSS Backport PR ipython#4158: generate choices for `--gui` configurable from real mapping Backport PR ipython#4143: update example custom.js Backport PR ipython#4144: help_end transformer shouldn't pick up ? in multiline string Backport PR ipython#4104: Add way to install MathJax to a particular profile ...
* commit 'rel-1.1.0-7-gf5891e9': (70 commits) Backport PR ipython#4346: getpass() on Windows & Python 2 needs bytes prompt Backport PR ipython#4336: use simple replacement rather than string formatting in format_kernel_cmd Backport PR ipython#4316: underscore missing on notebook_p4 Backport PR ipython#4257: fix unicode argv parsing Backport PR ipython#4209: Magic doc fixes Backport PR ipython#4204: remove some extraneous print statements from IPython.parallel back to dev release 1.1.0 don't upload to GitHub in release script 1.1 backport stats Backport PR ipython#4188: Allow user_ns trait to be None Backport PR ipython#4189: always fire LOCAL_IPS.extend(PUBLIC_IPS) Backport PR ipython#4174: various issues in markdown and rst templates Backport PR ipython#4181: nbconvert: Fix, sphinx template not removing new lines from headers Backport PR ipython#4043: don't 'restore_bytes' in from_JSON Backport PR ipython#4178: add missing data_javascript Backport PR ipython#4136: catch javascript errors in any output Backport PR ipython#4163: Fix for incorrect default encoding on Windows. Backport PR ipython#4171: add nbconvert config file when creating profiles Backport PR ipython#4159: don't split `.cell` and `div.cell` CSS ...
don't 'restore_bytes' in from_JSON It makes no sense to coerce base64-encoded unicode strings into base64-encoded byte strings. closes ipython#4036
It makes no sense to turn base64-encoded unicode strings into base64-encoded byte strings.
I can't think why we do this, but we should be very careful about testing before merging this fix.
fixes the issue tested in #4036.