Skip to content

Abort from type checking mismatch between _suggestions__generate_suggestions_impl and _Py_CalculateSuggestions #131936

@devdanzin

Description

@devdanzin

Crash report

What happened?

This is a silly one: _suggestions__generate_suggestions_impl, which checks whether the candidates is a list or subclass, calls _Py_CalculateSuggestions, which checks whether candidates is an exact list instance with an assert that fails if _suggestions._generate_suggestions receives an instance of a list subclass.

import _suggestions
class L(list): pass
_suggestions._generate_suggestions(L(), "")
python: Python/suggestions.c:132: _Py_CalculateSuggestions: Assertion `PyList_CheckExact(dir)' failed.
Aborted (core dumped)

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows, Linux

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

Python 3.14.0a6+ (heads/main:be2d2181e62, Mar 31 2025, 07:30:17) [GCC 11.4.0]

Linked PRs

Metadata

Metadata

Assignees

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dump

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions