Closed jacobtylerwalls closed 3 years ago
Also, our unit tests didn't test writing pickles in the converter.parse()
workflow, I take it -- just the parsing of files.
Bad XML file. Finale works around it; MuseScore crashes. So not a "regression" per se-- not supported--but did expose some missing guardrails.
MusicXML parser creates chords after notes and spanners. So the notes have to be replaced by chords. The series of calls go all the way up to Stream.replace()
where there is no guard against inserting an element already in the stream, in this case, the SpannerStorage
of the slur.
This should raise, it seems to me:
>>> c = chord.Chord()
>>> n1 = note.Note()
>>> n2 = note.Note()
>>> s = stream.Stream([n1, n2])
>>> s.replace(n1, c)
>>> s.replace(n2, c)
>>> for e in s:
... print(e, id(e))
...
<music21.chord.Chord object at 0x1020ffd00> 4329569536
<music21.chord.Chord object at 0x1020ffd00> 4329569536
The violation in the GuitarPro file is that a slur started on a grace note and ended on a chord, but there were slur stop tags on each note of the chord dyad. So I would let the XML parser choke in the above example when trying to replace "n2" with "c" when "c" already exists.
Well, hang on, we could just be nice and do nothing. That seems fine. Matches the behavior if the target cannot be found.
music21 version
6.7.0
Problem summary The GuitarPro file provided in a list message about grace notes and lyrics can't be parsed after a regression in 01597856f0ad7e4f113c05aab27706625aed82f8 (feature using templates instead of deepcopies for joinable groups) when serializing fails. Workaround is to use
storePickle=False
so that a pickle isn't written.Steps to reproduce
frag.xml.zip
More information At a glance, it looks like after 01597856f0ad7e4f113c05aab27706625aed82f8 there are some missing spanners in the lower part. They're gathered on musicxml export but not when serializing or getting a text dump from
.show('text')
, so that may have been how we missed this. Probably just need to gather missing spanners again before serializing.