Merged revisions 88147 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88147 | antoine.pitrou | 2011-01-23 18:12:25 +0100 (dim., 23 janv. 2011) | 3 lines

  Issue #10987: Fix the recursion limit handling in the _pickle module.
........
This commit is contained in:
Antoine Pitrou 2011-01-23 17:21:28 +00:00
parent eb9d5ad6ba
commit 0f2a61a11e
3 changed files with 20 additions and 7 deletions

View file

@ -77,14 +77,15 @@ def test_cpickle(_cache={}):
except ImportError:
print("cannot import _pickle, skipped!")
return
l = None
k, l = None, None
for n in itertools.count():
try:
l = _cache[n]
continue # Already tried and it works, let's save some time
except KeyError:
for i in range(100):
l = [l]
l = [k, l]
k = {i: l}
_pickle.Pickler(io.BytesIO(), protocol=-1).dump(l)
_cache[n] = l