Repository navigation
Conversation
A default whose == can't be used as a bool (a numpy array, for one) made docments and DocmentTbl raise ValueError, because they compared values to empty with == and !=.
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.
docmentsandDocmentTblcompare parameter defaults and annotations toinspect.Parameter.emptywith==/!=. When a default's==doesn't return a plain bool, such as a numpy array, that comparison raises:This is the root cause of AnswerDotAI/nbdev#1322 (
nbdev_readme/show_doccrashing on such a function). The traceback there points at the old nbdev copy of this code, but the same comparisons live infastcore.docmentsnow.emptyis a sentinel, so the fix compares by identity (is/is not) at every place in04_docments.ipynb.fastcore/docments.pywas regenerated withnbdev-export.Test: a new cell uses a default whose
__eq__/__ne__raise, and checksdocments(..., full=True)andDocmentTbl. It fails withValueErrorbefore the change and passes after.nbdev-test nbs/04_docments.ipynbpasses. The fullnbdev-testrun gives the same notebook failures with and without this change on my machine (network/optional deps: 02, 03, 03a, 03b, 05, 12, 13).I used an AI assistant to help write this change; I reproduced the bug, checked the fix and ran the tests myself.