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 — gh-155376: prevent supercheck NULL dereference by BHUVANSH855 · Pull Request #155379 · python/cpython

Conversation

@BHUVANSH855

@BHUVANSH855 BHUVANSH855 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix a NULL dereference in supercheck() when an uninitialized super object is used as a descriptor.

What happened?

super.__new__(super) can create a super object whose internal type field is NULL. When that object is subsequently used through __get__(), supercheck() receives the NULL type pointer.

The error-handling path in supercheck() eventually formats an error message using type->tp_name, causing a NULL pointer dereference and a segmentation fault.

Fix

This change:

  • Adds an explicit NULL check for type in supercheck().
  • Raises TypeError("super object has no type") instead of dereferencing the NULL pointer.
  • Uses tp_alloc() directly in super_descr_get() for the internal super object allocation.
  • Adds a regression test for the uninitialized super case.
  • Adds a NEWS entry documenting the crash fix.

Reproducer

Before this change:

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

resulted in:

Segmentation fault (core dumped)

After this change:

TypeError: super object has no type

Tests

./python -m test test_super — passed
./python -m test test_super test_descr — passed
git diff --check — passed

Closes issue gh-155376

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@BHUVANSH855
pythongh-155376: prevent supercheck NULL dereference
287f403
@BHUVANSH855
BHUVANSH855 requested a review from markshannon as a code owner August 8, 2026 14:01
@bedevere-app bedevere-app Bot mentioned this pull request Aug 8, 2026
super.__new__(super) can create an object that causes a NULL dereference in supercheck() #155376
Open
@bedevere-app bedevere-app Bot added the awaiting review label Aug 8, 2026
BHUVANSH855 added 2 commits August 8, 2026 14:05
@BHUVANSH855
pythongh-155376: fix NEWS entry filename
c15c0bb
@BHUVANSH855
pythongh-155376: fix NEWS entry formatting
fdcf59d
@simitana

This comment has been minimized.

Sign in to view
@picnixz

picnixz commented Aug 9, 2026

Copy link
Copy Markdown
Member

@simitana I already asked you to avoid LLM generated answers. If this behavior continues we will restrict your access to our repositories.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Nov 12, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 90 days with no activity.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting review stale Stale PR or inactive for long period of time.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@BHUVANSH855 @simitana @picnixz
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.