Author: Anton Gulenko <anton.gule...@googlemail.com> Branch: storage Changeset: r784:ff6b7ae58916 Date: 2014-04-07 19:14 +0200 http://bitbucket.org/pypy/lang-smalltalk/changeset/ff6b7ae58916/
Log: Moved image-loading code to ensure proper error handling. diff --git a/targetimageloadingsmalltalk.py b/targetimageloadingsmalltalk.py --- a/targetimageloadingsmalltalk.py +++ b/targetimageloadingsmalltalk.py @@ -202,13 +202,13 @@ path = rpath.rabspath(path) try: f = open_file_as_stream(path, mode="rb", buffering=0) + try: + imagedata = f.readall() + finally: + f.close() except OSError as e: os.write(2, "%s -- %s (LoadError)\n" % (os.strerror(e.errno), path)) return 1 - try: - imagedata = f.readall() - finally: - f.close() image_reader = squeakimage.reader_for_image(space, squeakimage.Stream(data=imagedata)) image = create_image(space, image_reader) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit