-
-
Notifications
You must be signed in to change notification settings - Fork 515
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
Remove some py2 tags in explain_pickle #33144
Comments
Branch: u/chapoton/33144 |
Commit: |
comment:1
boring and painful update.. any expert on pickles aboard ? New commits:
|
comment:3
ok, let's do that in several steps. Please review this first step. |
comment:6
please somebody have a look This is the last file containing One alternative would be #27350 (externalize) or just drop the file completely. |
comment:7
It would be wonderful for Erik Bray to work on #27350 and close this ticket as If that would not happen, then I think we should fix |
comment:8
As far as I understand, Erik is no longer available. |
Reviewer: Travis Scrimshaw |
comment:9
In principle, I agree with #27350, but I am slightly worried about the practice of it since I find this tool to be very useful at times and would be saddened if it bitrotted. I, unfortunately, would not be able to maintain such a package as I don't understand how Kwankyu, any objections to me setting a positive review? |
comment:10
Replying to @tscrim:
Some outputs from sage: from sage.misc.explain_pickle import *
- sage: test_pickle(dumps(100000r, compress=False)) # py2
- 0: \x80 PROTO 2
- 2: J BININT 100000
- 7: . STOP
- highest protocol among opcodes = 2
- explain_pickle in_current_sage=True/False:
- 100000
- result: 100000
+ sage: test_pickle(dumps(100000r, compress=False))
+ 0: \x80 PROTO 2
+ 2: c GLOBAL '_codecs encode'
+ 18: q BINPUT 0
+ 20: X BINUNICODE '\x80\x02J\xa0\x86\x01\x00.'
+ 36: q BINPUT 1
+ 38: X BINUNICODE 'latin1'
+ 49: q BINPUT 2
+ 51: \x86 TUPLE2
+ 52: q BINPUT 3
+ 54: R REDUCE
+ 55: q BINPUT 4
+ 57: . STOP
+ highest protocol among opcodes = 2
+ explain_pickle in_current_sage=True:
+ from _codecs import encode
+ encode('\x80\x02J\xa0\x86\x01\x00.', 'latin1')
+ explain_pickle in_current_sage=False:
+ pg_encode = unpickle_global('_codecs', 'encode')
+ pg_encode('\x80\x02J\xa0\x86\x01\x00.', 'latin1')
+ result: b'\x80\x02J\xa0\x86\x01\x00.' seem wrong, which indicates it worked fine with py2 but is now broken with py3. Do we ever correct doctests for wrong output? I think leaving them with py2 tag is right if we do not fix the broken Indentations of outputs are wrong. |
comment:11
Replying to @kwankyu:
The pickle itself has changed. If you run
Indeed; although I found the extra indentation level helped make clear what the doctest outputs were since they are so long with their own indentation. I don't hold a strong opinion on changing this or not. |
comment:12
Replying to @tscrim:
I meant the |
comment:13
Replying to @kwankyu:
I believe it is the right result but represented or interpreted in the wrong format. Mainly the bytes returned are not converted to a string correctly or something similar. |
comment:14
Perhaps we just don't remove the tag in the cases when the result is (at least superficially) different? |
comment:15
Replying to @tscrim:
+1 |
Changed branch from u/chapoton/33144 to public/ticket/33144-short |
comment:16
here is a new branch, where I have dropped the changes that did no look right I may have missed some New commits:
|
comment:17
How about indentations? Did you indent more spaces intentionally? |
comment:18
I think outputs should look as they do on the command line, modulo wrappings. |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:20
now the same as previous one, only with less indentations |
comment:21
Thanks. But some cases with different |
patch for removing some #py2 tags |
comment:22
Attachment: 0001-removal-of-py2-tag-in-doctests-of-explain-pickle-fir.patch.gz Then maybe the simplest way would be if you could please edit the attached patch file : keep only the changes that you find appropriate and make a branch from that modified patch. |
comment:24
Replying to @fchapoton:
That is done over your last commit. |
Changed reviewer from Travis Scrimshaw to Travis Scrimshaw, Kwankyu Lee |
This comment has been minimized.
This comment has been minimized.
comment:25
I am positive now. |
This comment has been minimized.
This comment has been minimized.
comment:26
thanks, you can set to positive if you wish |
comment:27
Thanks. |
Changed branch from public/ticket/33144-short to |
We remove some py2 tags from
explain_pickle
doctests which we still get correct results (with python3).CC: @embray @mjungmath @tscrim
Component: python3
Author: Frédéric Chapoton
Branch/Commit:
131841f
Reviewer: Travis Scrimshaw, Kwankyu Lee
Issue created by migration from https://trac.sagemath.org/ticket/33144
The text was updated successfully, but these errors were encountered: