XZise added a comment. It's interesting that removing the temporary file fails. It doesn't seem to fail when it's writing the file. Although to be honest I'm not sure how Python behaves when an error occurs inside the try, and then an error occurs in the finally. Now it also happens on Python 3 build which probably mentions both exceptions: https://ci.appveyor.com/project/jayvdb/pywikibot-core/build/1.0.win32-iobase.761/job/phubke19lwht0y96#L3595
So it only seems to be an issue with removing. Now all three file accesses in the `_write_content` are protected using a with-statement, so in theory they should be closed. But the last one is returning, which shouldn't be an issue in Python as it still executes the finally, but maybe it does the following: - `__enter__` and open the file - read file contents and “cache them” to return them - do `finally` because of the return - `__exit__` which closes the file Maybe someone using Win32 could verify that the context manager's `__exit__` is called after the return? Alternatively it might work when we cache the value manually and return outside the `with`. TASK DETAIL https://phabricator.wikimedia.org/T113127 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: XZise Cc: Aklapper, XZise, jayvdb, pywikibot-bugs-list _______________________________________________ pywikibot-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs
