Un-deprecate getdata(); have it return an ImageLinearAccess object - #9883
Un-deprecate getdata(); have it return an ImageLinearAccess object#9883akx wants to merge 1 commit into
getdata(); have it return an ImageLinearAccess object#9883Conversation
|
Didn't think I'd bump into a PyPy bug implementing this, but here we are... pypy/pypy#5526 |
d8ff245 to
ecf4175
Compare
ecf4175 to
3756d89
Compare
|
Could you identify exactly what workaround you added for that, so that one day when the PyPy fix has propagated, we are able to remove it? |
|
|
||
| def test_getdata_does_not_expose_the_image_core() -> None: | ||
| hopper_data = hopper().getdata() | ||
| # "Weird" core bits are not exposed: |
There was a problem hiding this comment.
Weird, as in things that a normal user shouldn't be touching (which was the thing in the first place). I can remove the comment if it's too weird in itself. :D
The workaround is the linear access type also act as a mapping ( IOW, there's nothing that necessarily needs to be removed. |
Follows up on #9292 to un-deprecate
getdata(), sinceget_flattened_data()is not a perfect replacement for linear access to image pixels given its upfront memory and time costs. (See #9292 (comment) for rationales.)Fixes #9261 (since
getdatanow returns a real, well-typed iterator/access object). Givenx.pylikepyright fails on
main:but is fine on this branch:
The optimizations from #9881 still help this too and don't conflict here.