Honor displayType='always' on first pitch too - #1996
Merged
Conversation
Pitch.updateAccidentalDisplay checked cautionaryAll and a displayType of 'always'/'even-tied' only after the `if not pitchPastAll:` early return, so the first pitch of a part -- the one case with nothing in the past -- never reached it and fell through to the key-signature branch instead. An explicitly requested accidental was silently switched off whenever the key signature made it redundant, and since MusicXML export gates on displayStatus, it was dropped from the exported file entirely. Hoist the block above the early return. When pitchPastAll is non-empty this is a no-op: the only thing it now precedes is the conflict loop, whose two outcomes (conflicting alteration -> True, same name -> break into this block -> True) both already ended in True. Port of the same fix in music21j (cuthbertLab/music21j#325). Version bumped to invalidate cached pickles: the musedata parser sets displayType='always', so cached scores can hold the old display statuses. AI-assisted (Claude)
Doctests demonstrate future usage, not bug fixes -- regression coverage belongs in test_pitch.py, where testDisplayTypeAlwaysWithNothingInPast already covers this. A simple bug fix does not warrant a "Changed in vXX" marker either. Also: the previous commit's stated reason for the version bump was wrong. It claimed cached musedata pickles could hold stale display statuses, but musedata/__init__.py sets displayStatus=True alongside displayType='always', so updateAccidentalDisplay returns at the existing displayStatus check well before the hoisted block, and makeAccidentals does not pass overrideStatus. No parsed output changes and no cache is invalidated. The bump to 11.0.0b8 stands only on the ordinary bug-fix rule. AI-assisted (Claude)
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.
First note in piece/part w/ explicit natural set with displayType='always', like tinyNotation Cn was being ignored. Fixed.
updateAccidentalDisplay was short circuiting early if there was no pitchPastAll -- so first note had no way of having its "always" or "even-tied" status read.
See same error in music21j: cuthbertLab/music21j#326
AI-assisted (Claude)