BUG: MaskedArray _optinfo dictionary is not updated when calling __eq__/__ne__#9279
BUG: MaskedArray _optinfo dictionary is not updated when calling __eq__/__ne__#9279schaefed wants to merge 1 commit intonumpy:masterfrom
Conversation
|
While probably right (don't know this stuff well enough to say right away). This requires a test to be merged (the tests are usually in the same folder where the code is in the "tests" subfolder. Also, please try to format your git commit according to our guidelines, such as |
|
Otherwise, thanks for creating a PR :) |
|
Why does |
|
@seberg: I added a simple test and sorry for ignoring your commit message format. |
|
...allright, I try to bring this issue back to the agenda by providing more details (maybe I should have done this earlier). At the moment I can add items to the _optdict attribute and the dictionary's content is usually propagated to masked arrays created during operations on the original one: x = np.ma.ones(10)
x._optinfo['test'] = True
(x > 4)._optinfo # {'test': True}
(x * 4)._optinfo # {'test': True}Only the __eq__/__ne__ methods behave differently: (x != 4)._optinfo # {}
(x == 4)._optinfo # {}I understand, that this is not a big issue for you, in the end it only affects a hardly documented feature. But it is still an inconsistency with a rather simple fix, that bit me, so I would be happy if this could be merged! |
|
Ok, if comparison preserves it, then I think I can accept that as an argument to make equality tests do so too |
numpy/ma/tests/test_core.py
Outdated
There was a problem hiding this comment.
Can you extend this test to a bunch more operations? Arithmetic and comparison would be good.
There was a problem hiding this comment.
(or does a test exist for this elsewhere?)
|
Done... |
|
Closing in favor of #9540 |
|
Why did you close this? |
|
He had created it against his own master, which is tricky stuff. Possibly you can change the backing branch nowadays, not sure. |
|
@seberg I haven't found a solution to do so... |
The _optinfo dictionary is not updated when calling eq/ne