Fix AttributeError on unresolved nested self-append (+=)#353
Open
santhreal wants to merge 1 commit into
Open
Conversation
The += desugaring built the self-substitution and its ConfigValues with a boolean in the instring slot instead of the source string. When such a substitution stayed unresolved, formatting the error via lineno()/col() did bool.count() and raised AttributeError instead of the intended ConfigSubstitutionException. Pass the real instring through so the typed error is raised with a correct line and column. Fixes chimpler#103
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 #103.
Parsing a
+=self-append on a nested key whose self-reference stays unresolved crashes with a rawAttributeError: 'bool' object has no attribute 'count'instead of the intended error message. The+=desugaring builds the self-substitution and itsConfigValueswith a boolean in theinstringslot, where every other call site passes the source string; when the unresolved substitution is reported,lineno(loc, instring)callsbool.count()and raises.Passing the real
instringthrough both call sites makes it raise the intendedConfigSubstitutionExceptionwith a correct line and column. Working+=on an existing key is unaffected.Repro: