Skip to content

BUG: Fix memory leak in _convert_from_type for custom scalar types - #31750

Merged
kumaraditya303 merged 1 commit into
numpy:mainfrom
mothman01:Dtype-leak
Jul 13, 2026
Merged

kumaraditya303 merged 1 commit into
numpy:mainfrom
mothman01:Dtype-leak

Conversation

@mothman01

Copy link
Copy Markdown
Contributor

PR summary

This PR is from issue #31676 addressing a memory leakage in descriptor.c at line 1598 to 1604 and I have checked and hit all guidlines to the best of my knowledge

First time committer introduction

I am michael cogan I am a physics student I have used numpy numerously throughout research and classes I chose this fix because I am trying to build up my resume and also thought it would be cool to help open source and I believed this was an easy enough fix for me to tackle as my first commit

AI Disclosure

I used Gemini pro to help me with understanding the scope of the file and I used to run personal tests to make sure the memory leak was fixed all code entered is mine

@shipitdev shipitdev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The Py_DECREF addition here now properly handles the leaked reference.

Congrats on your first PR here :) welcome to NumPy! This LGTM.

@kumaraditya303
kumaraditya303 merged commit b21650c into numpy:main Jul 13, 2026
87 of 88 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants