diff options
author | Simon McVittie <smcv@collabora.com> | 2017-06-19 11:33:49 +0100 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2017-06-19 11:33:49 +0100 |
commit | 553bdc9f43fc1d614cd7424ebcff759073bf5bf6 (patch) | |
tree | 8a35f4e239792a8f181d05745d3d466f04dbe7ea /gir/gio-2.0.c | |
parent | e8f39a0a2408898e8a36e9011705c7a55f115afc (diff) | |
download | gobject-introspection-553bdc9f43fc1d614cd7424ebcff759073bf5bf6.tar.gz |
When handling errors according to errno, catch both IOError and OSError
Different Python versions are not completely consistent about the
error that is raised and its class hierarchy:
Python 3.5.3rc1 (default, Jan 3 2017, 04:40:57)
>>> try: open('/foo')
... except Exception as e: print(e.__class__.__mro__)
(<class 'FileNotFoundError'>, <class 'OSError'>, <class 'Exception'>, <class 'BaseException'>, <class 'object'>)
Python 2.7.13 (default, Dec 18 2016, 20:19:42)
>>> try: open('/foo')
... except Exception as e: print e.__class__.__mro
(<type 'exceptions.IOError'>, <type 'exceptions.EnvironmentError'>, <type 'exceptions.StandardError'>, <type 'exceptions.Exception'>, <type 'exceptions.BaseException'>, <type 'object'>)
This can lead to a race condition during cache cleaning, where two
processes both try to delete the same file, and the one that loses
the race fails.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Iain Lane <laney@ubuntu.com>
Reviewed-by: Colin Walters <walters@verbum.org>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=772173
Diffstat (limited to 'gir/gio-2.0.c')
0 files changed, 0 insertions, 0 deletions