mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
Issue #10987: Fix the recursion limit handling in the _pickle module.
This commit is contained in:
parent
0929b1fc70
commit
e6d4c5bab8
3 changed files with 24 additions and 14 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue