rdiff-backup-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obsolescence Python 3.5 support plan


From: Frank Crawford
Subject: Re: Obsolescence Python 3.5 support plan
Date: Wed, 10 Jun 2020 21:37:01 +1000
User-agent: Evolution 3.36.3 (3.36.3-1.fc32)

On Wed, 2020-06-10 at 07:31 +0200, Eric L. Zolf wrote:
> Hi Derek,
> 
> On 09/06/2020 16:24, Derek Atkins wrote:
> > EricZolf <ewl+rdiffbackup@lavar.de> writes:
...
> Nothing is impossible, the question is rather how much effort you put
> into it.
> 
> You can find zillions of explanations on the web about what happened
> between Python 2 and Python 3 (py2 and py3 for short), but my view in
> short:
> 
> - despite the same name, str in py2 is not str in py3 but rather
> bytes
> (but not quite, sometimes they're the same conceptually, but still
> different objects)
> - unicode in py2 disappeared in py3 and became a sub-case of str in
> py3
> - so unicode + str in py2 became str + bytes in py3 with an imperfect
> overlap, and no way to absolutely decide how to convert.
> - i.e. the context needs to be considered to decide if a py2-str
> needs
> to become a py3-str or a py3-bytes, this would need analyzing the
> code
> line by line and deciding based on the context. Effort goes through
> the
> rough!
> - to make things even more complicated, as they are not the same
> objects
> even if they are called the same, pickle interprets them differently:
> 
> * Python 3:
> > > > pickle.dumps('xxx',1)
> 
> b'X\x03\x00\x00\x00xxxq\x00.'
> > > > pickle.dumps(b'xxx',1)
> 
> b'c_codecs\nencode\nq\x00(X\x03\x00\x00\x00xxxq\x01X\x06\x00\x00\x00l
> atin1q\x02tq\x03Rq\x04.'
> > > > pickle.dumps(u'xxx',1)
> 
> b'X\x03\x00\x00\x00xxxq\x00.'
> 
> * Python 2:
> > > > pickle.dumps('xxx',1)
> 
> 'U\x03xxxq\x00.'
> > > > pickle.dumps(b'xxx',1)
> 
> 'U\x03xxxq\x00.'
> > > > pickle.dumps(u'xxx',1)
> 
> 'X\x03\x00\x00\x00xxxq\x00.'

And just to add to the complexity, it isn't just data, but objects that
are passed across the network.  The function names to process the data
are in the data packets and are encoded in the native str type for the
implementation, which is bytes in py2 and unicode in py3.  Trying to
convert function names on the fly is next to impossible without
rewriting the pickle code from the ground up.

> 
> Hope this helps understand the complexity of what you are/were
> asking.
> 
> KR, Eric
> 
> > -derek
> > 

Regards
Frank




reply via email to

[Prev in Thread] Current Thread [Next in Thread]