Skip to content

makeNdArray: return pyarray directly instead of bp::incref - #108

Open
clemisch wants to merge 3 commits into
diffpy:mainfrom
clemisch:fix_pyarray_ref
Open

makeNdArray: return pyarray directly instead of bp::incref #108
clemisch wants to merge 3 commits into
diffpy:mainfrom
clemisch:fix_pyarray_ref

Conversation

@clemisch

Copy link
Copy Markdown
Contributor

Backend helper makeNdArray unnecessarily uses bp::incref on returned array. This increases its refcount from 1 to 2 and effectively leads to a memory leak. PyArray_SimpleNew() already returns a new reference with refcount 1 so the incref is unnecessary.

@clemisch

clemisch commented Aug 25, 2026

Copy link
Copy Markdown
ContributorAuthor

PS: I know this number of incoming contributions might look a bit... suspicious these days. I have been using them for months in my forks; it's just that I finally contribute them upstream now all at once ;-)

E.g. this one is here: clemisch@0786ab5

@vincefn

Copy link
Copy Markdown
Collaborator

Can you add the corresponding news item ?

@clemisch

Copy link
Copy Markdown
ContributorAuthor

done

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@clemisch@vincefn