Skip to content

crash in PyTuple_GET_SIZE: Assertion `PyTuple_Check(op)' failed #138479

Closed

Description

@15r10nk

Crash report

What happened?

The following code causes a crash in cpython:

class Generic:

    def __call__(*a):
        print(a)

    def __getattr__(self, name):
        return Generic()

name_5 = Generic()
type name_3[*name_2] = 0
name_3[name_5][0]

output:

(<__main__.Generic object at 0x7fb99dc5a280>, name_3[<__main__.Generic object at 0x7fb99d792420>], (0,))
(<__main__.Generic object at 0x7fb99dbd7960>, None)
python3: ./Include/cpython/tupleobject.h:24: PyTuple_GET_SIZE: Assertion `PyTuple_Check(op)' failed.
fish: Job 1, '../cpython/install/bin/python3 …' terminated by signal SIGABRT (Abbruch)

I found this example while fuzzing with pysource-codegen.

CPython versions tested on:

3.12, 3.13, 3.14, 3.15

Operating systems tested on:

Linux

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

Python 3.14.0rc2+ (heads/3.14:45a79b4f4b7, Sep 3 2025, 22:05:34) [GCC 12.2.0]

Linked PRs

Activity

  1. added
    type-crashA hard crash of the interpreter, possibly with a core dump
    on Sep 3, 2025
  2. added
    3.13only security fixes
    3.14bugs and security fixes
    3.15bugs and security fixes
    on Sep 3, 2025
  3. ZeroIntensity commented on Sep 3, 2025

    @ZeroIntensity
    Member

    I think I see the problem. I'll work on a fix.

  4. added a commit that references this issue on Sep 11, 2025
  5. added a commit that references this issue on Sep 11, 2025
  6. added 3 commits that reference this issue on Sep 11, 2025
  7. ZeroIntensity commented on Sep 11, 2025

    @ZeroIntensity
    Member

    The 3.14 backport will be merged separately (probably in 3.14.1), thanks for the report!

  8. added a commit that references this issue on Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13only security fixes3.14bugs and security fixes3.15bugs and security fixesinterpreter-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