[PATCH] py3: conditionalize the cPickle import

timeless timeless at gmail.com
Thu May 26 14:07:02 EDT 2016


https://bitbucket.org/timeless/mercurial-crew/commits/all?search=95fa2c1::86286796f550

pickle is here:
https://bitbucket.org/timeless/mercurial-crew/commits/dd88a5baf8e790823df15001f35d459e81c372fd

On Thu, May 26, 2016 at 2:00 PM, Martijn Pieters <mj at zopatista.com> wrote:
> On 26 May 2016 at 10:50, timeless <timeless at gmail.com> wrote:
>> r-.
>> this is wrong. you need to access a member variable in order to
>> trigger demandload.
>
> Ah, yes, detecting if a module is not available is.. tricky. So the
> following would work?
>
>     try:
>         import cPickle as pickle
>         # force the module to load to avoid demandimport masking a
> missing module
>         pickle.dumps
>     except ImportError:
>         import pickle
>
> --
> Martijn Pieters


More information about the Mercurial-devel mailing list