Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

sys.setrecursionlimit no longer affecting pickle.dump #128590

Copy link
Copy link
Open
@Jiehong

Description

@Jiehong
Issue body actions

Bug report

Bug description:

This is a follow up of #112282 (updating doc).
It's also a different case of #128544 (import chains impacted).

In particular, on top of the doc no longer being correct for sys.setrecursionlimit, the regression needs to be fixed.

Note: this works in python 3.11 or below.

import pickle
import sys

nested_object = current = {}
for i in range(10000):
    current['nested'] = {}
    current = current['nested']

sys.setrecursionlimit(3750000)
x = pickle.dumps(nested_object)

Result of the run:

▶▶ python3.11 test-issue.py
# runs ok

▶▶ python3.12 test-issue.py
Traceback (most recent call last):
  File "~/test-issue.py", line 10, in <module>
    x = pickle.dumps(nested_object)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
RecursionError: maximum recursion depth exceeded while pickling an object

Impact: all programs trying to pickle data that is too nested cannot be ported to python 3.12 or 3.13 so far

CPython versions tested on:

3.12, 3.13

Operating systems tested on:

Linux, macOS, Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixesextension-modulesC modules in the Modules dirC modules in the Modules dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.