sbt <shibt...@gmail.com> added the comment:

I now realise latin_1_encode won't work because it returns a pair (bytes_obj, 
length).

I have done a patch using _codecs.encode instead -- the pickles turn out to be 
exactly the same size anyway.

>>> pickletools.dis(pickle.dumps(b"abc", 2))
    0: \x80 PROTO      2
    2: c    GLOBAL     '_codecs encode'
   18: q    BINPUT     0
   20: X    BINUNICODE 'abc'
   28: q    BINPUT     1
   30: X    BINUNICODE 'latin1'
   41: q    BINPUT     2
   43: \x86 TUPLE2
   44: q    BINPUT     3
   46: R    REDUCE
   47: q    BINPUT     4
   49: .    STOP

----------
Added file: http://bugs.python.org/file23938/issue13505-codecs-encode.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue13505>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to