[pypy-commit] pypy default: Fix the complexity in cPickle.py too (there's a mostly-duplicate?)
arigo
pypy.commits at gmail.com
Tue Jan 5 08:46:32 EST 2016
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r81580:256ca06a4fb1
Date: 2016-01-05 13:50 +0000
http://bitbucket.org/pypy/pypy/changeset/256ca06a4fb1/
Log: Fix the complexity in cPickle.py too (there's a mostly-duplicate?)
diff --git a/lib_pypy/cPickle.py b/lib_pypy/cPickle.py
--- a/lib_pypy/cPickle.py
+++ b/lib_pypy/cPickle.py
@@ -559,6 +559,7 @@
def decode_long(data):
r"""Decode a long from a two's complement little-endian binary string.
+ This is overriden on PyPy by a RPython version that has linear complexity.
>>> decode_long('')
0L
@@ -592,6 +593,11 @@
n -= 1L << (nbytes << 3)
return n
+try:
+ from __pypy__ import decode_long
+except ImportError:
+ pass
+
def load(f):
return Unpickler(f).load()
More information about the pypy-commit
mailing list