Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #947, reported by @j45856021-dev.
Assigning through a boolean mask to a list-backed
LtreatsFalseandTrueas integer indices 0 and 1. For example,values = L(10,20,30); values[[False,False,True]] = 99produces[99,99,30]instead of[10,20,99], and an all-false mask still changes data.Normalize Python boolean index lists with the existing
mask2idxshelper before assignment. Preserve the original path for native array selectors. Update the owning notebook and regeneratefastcore/foundation.py; add scalar/iterable and all-false-mask regressions plus native NumPy selector controls.Validation on Windows with Python 3.12.14, fastcore 2.2.34 and nbdev 3.3.25:
nbdev-test nbs/02_foundation.ipynb --n-workers 1 --verbose: identical added tests fail on the unchanged baseline and pass with the fix.Land iterator masks, scalar/iterable replacements, all-false/all-true/empty selectors and integer/slice controls. All 28 affected cases are corrected; all 18 previously working cases retain their outputs.nbdev-export --path nbs/02_foundation.ipynband the official notebook-cleaning check pass.nbdev-test --n-workers 1 --verbosecommand was run on both versions. It retains five pre-existing failing notebooks on Windows:01_basics,03_xtras,03a_parallel,03b_netand12_tools; the added foundation regression is the sixth failure on the baseline and passes after the fix. The full suite is not claimed as passing. No tests or CI settings were changed to suppress these failures.This addresses Python boolean masks. NumPy boolean scalars inside index lists remain unsupported with NumPy 2.5.4. Other operating systems, documentation rendering and performance were not tested.