GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `super.__new__(super)` can create an object that causes a NULL dereference in supercheck() · Issue #155376 · python/cpython

super.__new__(super) can create an object that causes a NULL dereference in supercheck() #155376

New issue
Copy link
New issue
Copy link
Open
Open
super.__new__(super) can create an object that causes a NULL dereference in supercheck()#155376
Copy link
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump

Description

@BHUVANSH855
BHUVANSH855
opened on Aug 8, 2026
Issue body actions

Crash report

What happened?

super.__new__(super) can create a super object whose internal type field is NULL. Using that object as a descriptor then causes a segmentation fault in supercheck().

Minimal reproducer:

s = super.__new__(super)
print(s)
s.__get__(1)

Output:

<super: <class 'NULL'>, NULL>
Segmentation fault (core dumped)

The one-line form also reproduces the crash:

super.__new__(super).__get__(1)

This is deterministic on the tested build.

A normal initialized super object does not crash:

class A:
    pass

class B(A):
    pass

s = super(B, B())
print(s.__get__(B()))

Output:

<super: <class 'B'>, ...>

GDB confirms the NULL dereference:

Program received signal SIGSEGV, Segmentation fault.
supercheck (type=0x0, obj=...)
    at Objects/typeobject.c:12605

The crashing code is:

PyErr_Format(PyExc_TypeError,
            "super(type, obj): obj (%s %.200s) is not "
            "an instance or subtype of type (%.200s).",
            type_or_instance, obj_str, type->tp_name);

Here type == NULL, so evaluating type->tp_name dereferences NULL.

The relevant call path is:

super.__new__(super)
    -> PyType_GenericNew()
    -> uninitialized super object (su->type == NULL)
    -> super_descr_get()
    -> supercheck(su->type, obj)
    -> type->tp_name
    -> SIGSEGV

PySuper_Type currently uses PyType_GenericNew as its tp_new, while initialization of the internal fields is performed separately by super_init. Therefore direct use of super.__new__(super) bypasses that initialization.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

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

Python 3.16.0a0 (heads/audit-objects-phase1-dirty:c3aefdb9eff, Aug 7 2026, 19:38:01) [GCC 13.3.0]

Linked PRs

  • gh-155376: prevent supercheck NULL dereference #155379

Activity

  1. BHUVANSH855
    added
    type-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
    on Aug 8, 2026
  2. aisk
    added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on Aug 8, 2026
  3. terryjreedy
    changed the title [-]super.__new__(super) can create an object that causes a NULL dereference in supercheck()[/-] [+]`super.__new__(super)` can create an object that causes a NULL dereference in supercheck()[/+] on Aug 8, 2026
  4. BHUVANSH855
    added 2 commits that reference this issue on Aug 8, 2026

    pythongh-155376: fix NEWS entry filename

    c15c0bb

    pythongh-155376: fix NEWS entry formatting

    fdcf59d
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

    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dumpA 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

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.