Skip to content

Avoid flipping displayStatus None -> True on explicit naturals#1975

Merged
mscuthbert merged 1 commit into
cuthbertLab:masterfrom
jacobtylerwalls:jtw/spurious-natural
Jul 9, 2026
Merged

Avoid flipping displayStatus None -> True on explicit naturals#1975
mscuthbert merged 1 commit into
cuthbertLab:masterfrom
jacobtylerwalls:jtw/spurious-natural

Conversation

@jacobtylerwalls

Copy link
Copy Markdown
Member

From the bottom of the bug report in cuthbertLab/music21j#315 (comment), I noticed that for a stream like d1 d1, when applying a Natural accidental to both notes with a displayStatus of None, only subsequent ones had an explicit displayStatus = True.

self.assertIsNone(last_note.pitch.accidental.displayStatus)
p.makeAccidentals(inPlace=True)
self.assertIs(first_note.pitch.accidental.displayStatus, False)
self.assertIs(last_note.pitch.accidental.displayStatus, False)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only this last assertion failed before.

Comment thread music21/pitch.py
# and it is not a natural, it should always be set to display
if (pPastInMeasure is False
and acc is not None
and acc.name != 'natural'

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See "not a natural" in the above comment.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow. it literally says that!

@mscuthbert mscuthbert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! Good catch!

Comment thread music21/pitch.py
# and it is not a natural, it should always be set to display
if (pPastInMeasure is False
and acc is not None
and acc.name != 'natural'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow. it literally says that!

@mscuthbert mscuthbert merged commit 164ed8d into cuthbertLab:master Jul 9, 2026
5 of 6 checks passed
@jacobtylerwalls jacobtylerwalls deleted the jtw/spurious-natural branch July 9, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants