Skip to content

Abort when using a tuple subclass instance as the bases parameter for type #132176

Closed
@devdanzin

Description

@devdanzin

Crash report

What happened?

The interpreter will abort when a new type is created using an instance of a subclass of tuple as the bases parameter due to a PyTuple_CheckExact(bases) assertion:

class weird_tuple(tuple): pass

c = type("c", weird_tuple((str,)), {})
python: Objects/typeobject.c:500: set_tp_bases: Assertion `PyTuple_CheckExact(bases)' failed.
Aborted (core dumped)

Found using fusil by @vstinner.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

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

Python 3.14.0a6+ (heads/main:04bc681e7cf, Apr 4 2025, 12:38:19) [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