{"action":"created","issue":{"url":"https://api.github.com/repos/numpy/numpy/issues/9269","repository_url":"https://api.github.com/repos/numpy/numpy","labels_url":"https://api.github.com/repos/numpy/numpy/issues/9269/labels{/name}","comments_url":"https://api.github.com/repos/numpy/numpy/issues/9269/comments","events_url":"https://api.github.com/repos/numpy/numpy/issues/9269/events","html_url":"https://github.com/numpy/numpy/pull/9269","id":236974922,"number":9269,"title":"ENH: Refactor updateifcopy","user":{"login":"mattip","id":823911,"avatar_url":"https://avatars3.githubusercontent.com/u/823911?v=3","gravatar_id":"","url":"https://api.github.com/users/mattip","html_url":"https://github.com/mattip","followers_url":"https://api.github.com/users/mattip/followers","following_url":"https://api.github.com/users/mattip/following{/other_user}","gists_url":"https://api.github.com/users/mattip/gists{/gist_id}","starred_url":"https://api.github.com/users/mattip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattip/subscriptions","organizations_url":"https://api.github.com/users/mattip/orgs","repos_url":"https://api.github.com/users/mattip/repos","events_url":"https://api.github.com/users/mattip/events{/privacy}","received_events_url":"https://api.github.com/users/mattip/received_events","type":"User","site_admin":false},"labels":[{"id":6359239,"url":"https://api.github.com/repos/numpy/numpy/labels/01%20-%20Enhancement","name":"01 - Enhancement","color":"fef2c0","default":false},{"id":36825825,"url":"https://api.github.com/repos/numpy/numpy/labels/03%20-%20Maintenance","name":"03 - Maintenance","color":"fef2c0","default":false},{"id":535402461,"url":"https://api.github.com/repos/numpy/numpy/labels/24%20-%20PyPy","name":"24 - PyPy","color":"fef2c0","default":false},{"id":16917029,"url":"https://api.github.com/repos/numpy/numpy/labels/component:%20numpy.core","name":"component: numpy.core","color":"009800","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-06-19T18:11:36Z","updated_at":"2017-06-19T18:58:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/numpy/numpy/pulls/9269","html_url":"https://github.com/numpy/numpy/pull/9269","diff_url":"https://github.com/numpy/numpy/pull/9269.diff","patch_url":"https://github.com/numpy/numpy/pull/9269.patch"},"body":"Fixes issue #7054 by refactoring the resolution of ``UPDATEIFCOPY`` into a new private API function ``PyArray_ResolveUpdateIfCopy``. Add a call to the function wherever a temporary ``ndarray`` with that flag is created, and added tests for calls that exercise the new function. \r\n\r\nIn the second commit I made nditer into a context manager, where ``PyArray_ResolveUpdateIfCopy`` is called on ``__exit__()``, and updated the nditer tests to use the context manager wherever the ``updateifcopy`` flag is used.\r\n\r\nThe third commit 4effdfb makes sure ``clip`` is called with a ``mode`` keyword, which seems to have been forgotten.\r\n\r\nThe last commit f012769 explicitly uses the ``__exit__`` method to resolve ``updateifcopy`` for iterators created with ``nested_iters``, how can I make this look nicer?"},"comment":{"url":"https://api.github.com/repos/numpy/numpy/issues/comments/309534236","html_url":"https://github.com/numpy/numpy/pull/9269#issuecomment-309534236","issue_url":"https://api.github.com/repos/numpy/numpy/issues/9269","id":309534236,"user":{"login":"mattip","id":823911,"avatar_url":"https://avatars3.githubusercontent.com/u/823911?v=3","gravatar_id":"","url":"https://api.github.com/users/mattip","html_url":"https://github.com/mattip","followers_url":"https://api.github.com/users/mattip/followers","following_url":"https://api.github.com/users/mattip/following{/other_user}","gists_url":"https://api.github.com/users/mattip/gists{/gist_id}","starred_url":"https://api.github.com/users/mattip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattip/subscriptions","organizations_url":"https://api.github.com/users/mattip/orgs","repos_url":"https://api.github.com/users/mattip/repos","events_url":"https://api.github.com/users/mattip/events{/privacy}","received_events_url":"https://api.github.com/users/mattip/received_events","type":"User","site_admin":false},"created_at":"2017-06-19T18:58:08Z","updated_at":"2017-06-19T18:58:08Z","body":"it is all very backward-compatible for CPython. ``PyArray_ResolveUpdateIfCopy`` can be called multiple times since it only does the copy dance if needed and then resets flags so subsequent calls will be ignored. For backward compatibility, I left a final call to ``PyArray_ResolveUpdateIfCopy`` in the ``tp_dealloc`` function. On PyPy however, the ``tp_dealloc`` function is not reliably called at a certain point in the program, so maybe that is the \"dangerous\" part?"}}
{"actor":{"display_login":"mattip"}}