[pypy-svn] r33044 - pypy/dist/pypy/translator/cli/src
antocuni at codespeak.net
antocuni at codespeak.net
Mon Oct 9 13:40:12 CEST 2006
Author: antocuni
Date: Mon Oct 9 13:40:10 2006
New Revision: 33044
Modified:
pypy/dist/pypy/translator/cli/src/ll_os.cs
Log:
Raise OSError when the file to be opened doesn't exist.
Modified: pypy/dist/pypy/translator/cli/src/ll_os.cs
==============================================================================
--- pypy/dist/pypy/translator/cli/src/ll_os.cs (original)
+++ pypy/dist/pypy/translator/cli/src/ll_os.cs Mon Oct 9 13:40:10 2006
@@ -203,9 +203,17 @@
{
FileAccess f_access = get_file_access(flags);
FileMode f_mode = get_file_mode(flags);
- FileStream stream = new FileStream(name, f_mode, f_access);
+ FileStream stream;
IFile f;
+ try {
+ stream = new FileStream(name, f_mode, f_access);
+ }
+ catch(FileNotFoundException e) {
+ Helpers.raise_OSError(Errno.ENOENT);
+ return -1;
+ }
+
// - on Unix there is no difference between text and binary modes
// - on Windows text mode means that we should convert '\n' from and to '\r\n'
// - on Mac < OS9 text mode means that we should convert '\n' from and to '\r' -- XXX: TODO!
More information about the Pypy-commit
mailing list