Author: Brian Kearns <[email protected]>
Branch: use-file-star-for-file
Changeset: r73398:d1feca94030c
Date: 2014-09-09 13:02 -0400
http://bitbucket.org/pypy/pypy/changeset/d1feca94030c/
Log: handle exception here
diff --git a/pypy/module/imp/interp_imp.py b/pypy/module/imp/interp_imp.py
--- a/pypy/module/imp/interp_imp.py
+++ b/pypy/module/imp/interp_imp.py
@@ -1,7 +1,7 @@
from rpython.rlib import rfile
from pypy.module.imp import importing
from pypy.module._file.interp_file import W_File
-from pypy.interpreter.error import OperationError, oefmt
+from pypy.interpreter.error import OperationError, oefmt, exception_from_errno
from pypy.interpreter.module import Module
from pypy.interpreter.gateway import unwrap_spec
@@ -32,7 +32,10 @@
def get_file(space, w_file, filename, mode):
if space.is_none(w_file):
- return rfile.create_file(filename, mode)
+ try:
+ return rfile.create_file(filename, mode)
+ except:
+ raise exception_from_errno(space, space.w_IOError)
else:
return space.interp_w(W_File, w_file).stream
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit