Issue #10987: Fix the recursion limit handling in the _pickle module.

This commit is contained in:
Antoine Pitrou 2011-01-23 17:12:25 +00:00
parent 0929b1fc70
commit e6d4c5bab8
3 changed files with 24 additions and 14 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