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 — BUG: fix crash in ufunc.resolve_dtypes with a Python scalar type by ngoldbaum · Pull Request #32496 · numpy/numpy

Conversation

@ngoldbaum

@ngoldbaum ngoldbaum commented Sep 3, 2026

Copy link
Copy Markdown
Member

PR summary

The Python ufunc.resolve_dtypes helper calls into this function without passing an explicit scalar object. This leads to a null-pointer dereference crash generating the error message for any of the cases in the test I added.

The fix is to check the operand flags if the scalar is NULL.

AI Disclosure

An AI model found the bug. I wrote the fix and had the model review it.

Sorry, something went wrong.

Uh oh!

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

All reactions
@ngoldbaum ngoldbaum added 00 - Bug 09 - Backport-Candidate PRs tagged should be backported labels Sep 3, 2026
@jorenham

jorenham commented Sep 3, 2026

Copy link
Copy Markdown
Member

related to #31734 ?

All reactions

Sorry, something went wrong.

Uh oh!

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

@ngoldbaum
ngoldbaum force-pushed the fix-resolve-dtypes-crash branch from 8007907 to 2fc4217 Compare September 3, 2026 21:30
@ngoldbaum

ngoldbaum commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

Nah, this is a different error path that is way less likely to be hit in real life. I hit this working on a fix for #32491.

jorenham reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@ngoldbaum ngoldbaum mentioned this pull request Sep 3, 2026
BUG: apply the NEP 50 scalar rules in concatenate and choose, and make casting="no" match "equiv" #32497
Merged
mhvk
mhvk approved these changes Sep 3, 2026
View reviewed changes

@mhvk mhvk left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. It seems slightly odd that scaler can be NULL, but maybe that's the price to pay for cross-using code. In any case, this doesn't hurt anything.

Sorry, something went wrong.

Uh oh!

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

All reactions
@ngoldbaum
BUG: fix null pointer dereference inside ufunc.resolve_dtypes
ac93346
@ngoldbaum
ngoldbaum force-pushed the fix-resolve-dtypes-crash branch from 2fc4217 to ac93346 Compare September 4, 2026 17:06
@ngoldbaum
ngoldbaum merged commit 5986d34 into numpy:main Sep 4, 2026
91 checks passed

Uh oh!

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

@ngoldbaum

ngoldbaum commented Sep 4, 2026

Copy link
Copy Markdown
Member Author

Thanks for the review!

All reactions

Sorry, something went wrong.

Uh oh!

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

@charris charris mentioned this pull request Sep 5, 2026
BUG: fix crash in ufunc.resolve_dtypes with a Python scalar type (#32496) #32509
Merged
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Sep 5, 2026
charris pushed a commit that referenced this pull request Sep 5, 2026
@ngoldbaum @charris
BUG: fix crash in ufunc.resolve_dtypes with a Python scalar type (#32496
65bb1da
)
charris added a commit that referenced this pull request Sep 5, 2026
@charris
Merge pull request #32509 from charris/backport-32496
fd4d908
BUG: fix crash in ufunc.resolve_dtypes with a Python scalar type (#32496)
ngoldbaum added a commit to ngoldbaum/numpy that referenced this pull request Sep 8, 2026
@ngoldbaum
BUG: fix crash in ufunc.resolve_dtypes with a Python scalar type (num…
bd9eea7
…py#32496)
ngoldbaum added a commit to ngoldbaum/numpy that referenced this pull request Sep 8, 2026
@ngoldbaum
BUG: fix crash in ufunc.resolve_dtypes with a Python scalar type (num…
22660f3
…py#32496)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mhvk mhvk mhvk approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

00 - Bug

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.

4 participants

@ngoldbaum @jorenham @mhvk @charris
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 01402775 — 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.