[sage-devel] Re: Unpickling problem (backwards incompatibility) in Python 3

2019-09-02 Thread Simon King
PS: On 2019-09-03, Simon King wrote: > - Without `encoding='bytes'`, Python-3 can in general not unpickle any > pickle created with Python-2 that contains strings. Stated differently: Ostensibly, Python-2 str corresponds to Python-3 bytes, and Python-2 unicode corresponds to Python-3 str. But

[sage-devel] Re: Unpickling problem (backwards incompatibility) in Python 3

2019-09-02 Thread Simon King
Hi! On 2019-09-02, Simon King wrote: > The problem apparently boils down to the following: > - Pickle the string '\x80\x1f' in Python-2 > - Try to load that pickle in Python-3 (it fails). > > Bummer! Nils Bruin pointed me to https://stackoverflow.com/questions/28218466/unpickling-a-python-2-obj

Re: [sage-devel] Re: Unpickling problem (backwards incompatibility) in Python 3

2019-09-02 Thread 'Julien Puydt' via sage-devel
Hi, Le 02/09/2019 à 22:43, Simon King a écrit : > AFAIK, what I need to unpickle my old data is a way to tell Python-3 > that it shall (at least temporarily) unpickle all strings as bytes, in > the sense that the pickled string  '\x80\x1f' should be understood as > b'\x80\x1f'. Is there a way? I t

[sage-devel] Re: Unpickling problem (backwards incompatibility) in Python 3

2019-09-02 Thread Simon King
On Monday, September 2, 2019 at 6:22:24 PM UTC+2, Simon King wrote: > > Also, if I understand the error message "UnicodeDecodeError: 'ascii' > codec can't decode byte 0x80 in position 0: ordinal not in range(128)" > correctly, it is an error in unpickling a string. And this, I believe, > can and

[sage-devel] Re: Unpickling problem (backwards incompatibility) in Python 3

2019-09-02 Thread Simon King
On 2019-09-02, Vincent Delecroix <20100.delecr...@gmail.com> wrote: > As discussed in > > https://groups.google.com/forum/#!topic/sage-devel/JuKzzgxDlmA > > Pickling/unpickling is not supposed to work accross Sage versions > (including the Python version you use). > > Is this what you are trying

[sage-devel] Re: Unpickling problem (backwards incompatibility) in Python 3

2019-09-02 Thread Simon King
On 2019-09-02, Simon King wrote: > Strangely, when I read the pickle as a string >open('path/to/file.sobj').read() > then it fails with a (different?) UnicodeError in Python-3. That's not the problem. However, I am not able to track down the problem myself. So, I'd appreciate help. I think I