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
File destructor alters mtime/ctime #648
Comments
Just a quick thought, if you can change the pytaglib's API, how about adding |
Yes, that's exactly what the user that reported the bug to be suggested. However, in upstream taglib the issue would remain - I think a |
IMO, it's logical that TagLib and pytaglib have different interfaces, since C++ and python are totally different animals. In C++, we can control the timing of destructor invocation. |
I don't really understand what is causing the mtime/ctime to change. |
@lalinsky As far as I understand, it's the But I agree with @TsudaKageyu that it's okay to have |
I assume that mtime/ctime are being modified by the call to |
@sbooth, good catch! It's worth it to try. |
I also approve flushing the stream in |
Right, we need an experiment to check if it works. |
I made this experiment, implementing |
FYI, the current pytaglib version 1.1.0 (supermihi/pytaglib@f9754bd) implements a |
A user of pytaglib pointed out the following issue to me, which is actually inherited from taglib itself:
Changing tags of a file and then calling
save()
will, as expected, immediately write the changes to disk and thereby alter the file's stats. However, once theFile
object is destroyed, the destructor ofFile
deletes thestream
attribute ofFilePrivate
, which in turn closes theFileStream
, which modifies the stats again. So, themtime
andctime
stats of the file won't match the timesave()
was called, but instead a later, potentially unpredictable (in case of garbage collection) moment.As this is definitely not the expected behavior, I would consider it a bug. However I'm afraid that it's not easy to fix, because the
File
implementation heavily relies onstream
being open, right?The text was updated successfully, but these errors were encountered: