Skip to content

ENH: Remove NpyIter_Close #11389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 20, 2018
Merged

Conversation

charris
Copy link
Member

@charris charris commented Jun 20, 2018

Backport of #11376.

PR #9998 introduced NpyIter_Close as part of the public C-API in order to resolve any WRITEBACK_IF_COPY semantics after iterator use. This PR removes it entirely, instead resolving writeback semantics in NpyIter_Deallocate.

Changes:

  • Extend NpyIter_Deallocate to include writeback resolution if needed via the operand-specific flag
  • Remove NpyIter_Close, adjust the c-api headers, documentation, and internal code.
  • Extend nditer_deallocate which is called as tp_dealloc for the python np.nditer to check if writeback resolution has occurred (via a context manager __exit__ or a direct call to np.close), and warn appropriately. This part requires introspection into the NpyIter. I created a non-public function to do so, is there a better way?
  • Remove a c-extension test for warnings if using NpyIter_Deallocate without NpyIter_Close
  • Repurpose a c-extension test to pure python since the warning moved levels

@charris charris added this to the 1.15.0 release milestone Jun 20, 2018
@charris charris merged commit 9af9d6d into numpy:maintenance/1.15.x Jun 20, 2018
@charris charris deleted the backport-11376 branch June 20, 2018 23:32
@eric-wieser
Copy link
Member

eric-wieser commented Jun 21, 2018

New function ``NpyIter_Close`` needs removing from the release notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants