-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modifying output of fix_end_of_track()
patially inconsistently modifies its input object
#530
Comments
fix_end_of_track()
fix_end_of_track()
patially inconsistently modifies its input object
I don't understand your description very well but I think this is coming from |
Yes, this is about |
Would freezing messages when associating them to a |
Even if we make it impossible for users to pass mutable messages as inputs to Consistently using Let's have an additional input argument to |
Since this is part of the public-ish API (not prepended by |
(Note to myself: |
…ordingly. I'm explicitly using `safe=True` in `merge_tracks()` to make it clear that that's a deliberate choice and `safe=False` is out of the question there (because the outputs of `merge_tracks()` might get modified by the user later).
Now `write_track()` explicitly promises to not further modify the outputs of `fix_end_of_track()`, so that the memory-friendly variant is used deliberately in this particular case, rather than used unintentionally always (with dangers) like four commits ago.
fix_end_of_track()
yieldsmsg
ormsg.copy()
depending on whether the previous message was a premature'end_of_track'
message.If I understand the difference between
msg
andmsg.copy()
correctly, the user offix_end_of_track()
, when trying to modify messages (for example changing the note from A to A♯) yielded byfix_end_of_track()
, will also modify some of the notes of the original input object offix_end_of_track()
but not other notes. So the changes of that original object will be inconsistent, they will depend on whether the previous message was'end_of_track'
.We can either replace
yield msg
byyield msg.copy()
or removeif accum:
andelse: yield msg
.The text was updated successfully, but these errors were encountered: