Restore _legacy_no_dict_keys_sorting so _check_legacy_cache2 can find 2.15.0 caches. - #8605
Open
cpruijsen wants to merge 1 commit into
Open
Restore _legacy_no_dict_keys_sorting so _check_legacy_cache2 can find 2.15.0 caches.#8605cpruijsen wants to merge 1 commit into
_legacy_no_dict_keys_sorting so _check_legacy_cache2 can find 2.15.0 caches.#8605cpruijsen wants to merge 1 commit into
Conversation
…find 2.15.0 caches.
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.
Summary
Restore the early return in
Pickler._batch_setitemsthat honours_legacy_no_dict_keys_sorting, keeping the*args/**kwargspassthrough from#7817.#7817updatedPickler._batch_setitemsfor Python 3.14's extra argument and, in the same hunk, dropped that return._check_legacy_cache2still patches_legacy_no_dict_keys_sortingto recompute theconfig_iddatasets 2.15.0 would have written, so since 4.4.0 the lookup hashes dicts with sorted keys and misses old cache directories whendata_fileskeys are not already sorted ({"train": ..., "test": ...}).With
_legacy_no_dict_keys_sortingset,Hasher.hash({"train": ["train.csv"], "test": ["test.csv"]})is again711511d8f1d9bc25, the value measured from 2.15.0 (issue author, Python 3.11) and reproduced here on 3.12. Default hashing is unchanged: the same two dicts still hash equal without the flag.Chose option 1 on #8410: restore the reader rather than delete the 2.14/2.15 compat path (option 2). That is what
#6514implemented and is two lines to revert. Can drop_check_legacy_cache2/ the flag instead if you would rather retire that layout.Fixes #8410
Test plan
tests/test_fingerprint.py::HashingTest::test_hash_dict_legacy_no_dict_keys_sortingfails without the early return (cfd3b51f0f8e9fd8==cfd3b51f0f8e9fd8) and passes with itHashingTestcases that do not need optional extras: 9 passed, 6 deselecteddata_fileswith unsorted keys and confirmbuilder.cache_dirpoints at that directory