histedit: don't bother with cPickle, demand-load pickle
We're unlikely to ever need the pickle module, so there's no good
reason to force loading of its faster cousin.
crecord: stop raising error.Abort if curses is not found (
issue5008)
On some servers, python curses support is disabled. This patch not only fixes
that but provides a fallback on other machines (e.g. Windows) when curses is
not found.
The previous code was actually flawed logic and relied on wcurses throwing an
ImportError which demandimport wouldn't throw. So, this patch also fixes that
problem.
cmdutil: use crecordmod.checkcurses
Instead of blindly trusting the user's experimental.crecord, we use checkcurses
to abstract that logic so that we can handle the case where python was not
built with curses.
crecord: ensure that curses is False if not imported
This provides no functional change but makes the next two patches easier to
review.
crecord: add helper function to determine if we should use curses
To fix
issue5008 properly, we need a helper function to determine if curses is
imported and also if the user has enabled the experimental flag.
crecord: use try/except for import of curses
Not only does this improve fragility with 'if os.name == ...' it will help
future patches enable the behavior to fallback to use plain record when curses
is unavailable (e.g. python compiled without curses support).
histedit: only use pickle if not using the modern save format
This avoids a case where PyPy's cPickle module throws a more confusing
error than CPython's.
perf: close transaction in perffncachewrite
This fixes a bug, and brings CPython behaviour on this test into
line with PyPy.
hbisect: use tryreadlines to load state
This closes the file handle after reading, which stops PyPy from
leaking open file handles and thus failing test-bisect3.t.
eol: make output stable
This eliminates a divergence in behaviour between PyPy and Python.