Antoine Pitrou <pit...@free.fr> added the comment:

> It may be better to modify _Unpickler_Read() so that it returns
> self->input_buffer (or even self->input_buffer + self->next_read_idx)
> for zero n.

I agree this would be better for readability and maintainability.

> On the other hand, my patch also eliminates redundant call to
> _Unpickler_Read() and makes load_binstring() and
> load_short_binstring() logic similar to that in load_counted_long().
> The main advantage, of course is skipping PyUnicode_Decode() which
> will load a codec potentially triggering an import and execution of
> python code.

Well, a theoretical argument could be made that some codec could return
a non-empty string when asked to decode an empty bytestring, but I'm not
sure it has much practical worth :)

----------
title: Some "trivial" python 2.x pickles fails to load in       Python 3.2 -> 
Some "trivial" python 2.x pickles fails to load in Python 3.2

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

Reply via email to