Skip to content
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

printed masked arrays #50

Open
ev-br opened this issue Jul 10, 2022 · 1 comment
Open

printed masked arrays #50

ev-br opened this issue Jul 10, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@ev-br
Copy link
Member

ev-br commented Jul 10, 2022

DTChecker gets into an infinite loop / hard crash in (observed in np.ma.__init__ docstring)

>>> x = np.array([2, 1, 3, np.nan, 5, 2, 3, np.nan])
>>> m = np.ma.masked_array(x, np.isnan(x))
>>> m
masked_array(data = [2.0 1.0 3.0 -- 5.0 2.0 3.0 --],
      mask = [False False False  True False False False  True],
      fill_value=1e+20)

Note that the data and mask arrays are missing commas.

The issue here is that the detection of a printed array (reinsert commas and retry) only looks at the opening square bracket in the beginning of the string. Thus DTChecker detects it's a masked array, does its .replace(--, 'nan') dance and retries. But data and mask arrays never get their commas reinserted, so the check fails again, detects a masked array and retries again until stopped by a recursion limit.

@ev-br ev-br added the bug Something isn't working label Jul 10, 2022
@ev-br
Copy link
Member Author

ev-br commented Apr 5, 2024

Maybe the right thing is to check presence of not only masked_array but also of -- in the DTChecker dance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant