Skip to content

Stack overflow error from recursion with 3.14.0rc1 on MacOS #137573

@cdce8p

Description

@cdce8p

Crash report

What happened?

In the pylint / astroid test suite we have a regression test for a common recursion issue on our end. Though the code triggers a deep recursion, so far CPython was still able to resolve it. While getting ready for 3.14, I noticed that a specific test started to crash Python but only on MacOS. Isolated Github action CI runs seem to confirm this, Ubuntu, Windows are completely fine both with 3.13.6 and 3.14.0rc1. However MacOS only passes with 3.13.6 while failing 3.14.0rc1. Noticeable 3.14.0a6 seems to be the last version which reliably still succeeded.

The releases have been downloaded from python.org; used the actions/setup-python action for tests in CI.

To bisect the issue further, I compiled 3.14.0rc1 on my Mac. Strangely though the test now passes, on the same system where the binary from python.org failed previously.

Local tests done with

  • MacOS 14 on M2 Pro
  • Python 3.14.0rc1 (v3.14.0rc1:48f88310044, Jul 22 2025, 13:06:29) [Clang 16.0.0 (clang-1600.0.26.6)] from https://www.python.org/downloads/release/python-3140rc1/ => test fails
  • Python 3.14.0rc1 (tags/v3.14.0rc1:48f88310044, Aug 9 2025, 00:54:21) [Clang 16.0.6 ] compiled manually => test succeeds
CC=/opt/homebrew/opt/llvm@16/bin/clang ./configure --with-openssl=$(brew --prefix openssl@3) --enable-optimizations --with-lto
make -j4 -s

Run the test case

git clone --depth 1 --branch v4.0.0b2 https://github.com/pylint-dev/astroid.git
cd astroid
python -m venv venv
source venv/bin/activate
pip install pytest==8.4.1 .
pytest tests/test_inference.py::test_recursion_on_inference_tip

Output with 3.14.0rc1 from python.org

(venv) MyMacBook-Pro:astroid $ pytest -s tests/test_inference.py::test_recursion_on_inference_tip
============================== test session starts ===================================
platform darwin -- Python 3.14.0rc1, pytest-8.4.1, pluggy-1.6.0
rootdir: /.../astroid
configfile: pyproject.toml
collected 1 item                                                                                                                                                                                                            

tests/test_inference.py Fatal Python error: _Py_CheckRecursiveCall: Unrecoverable stack overflow (used 3953 kB)
Python runtime state: initialized

Current thread 0x00000001dc071ec0 (most recent call first):
  File "/.../astroid/astroid/decorators.py", line 81 in inner
  File "/.../astroid/astroid/nodes/node_classes.py", line 451 in _infer
  ...
  File "/.../astroid/astroid/decorators.py", line 44 in wrapped
  File "/.../astroid/astroid/decorators.py", line 81 in inner
Abort trap: 6

Output with 3.14.0rc1 compiled locally

tests/test_inference.py::test_recursion_on_inference_tip PASSED

--
I'd be grateful about any pointers to things I'm doing "wrong" in my local build that prevent me from reproducing and bisecting the issue.

CPython versions tested on:

3.14

Operating systems tested on:

macOS

Output from running 'python -VV' on the command line:

Python 3.14.0rc1 (v3.14.0rc1:48f88310044, Jul 22 2025, 13:06:29) [Clang 16.0.0 (clang-1600.0.26.6)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and security fixesOS-macrelease-blockertype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions