[PATCH] py3: conditionalize the cPickle import

Martijn Pieters mj at zopatista.com
Thu May 26 14:00:11 EDT 2016


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