Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
cfe83db0
Commit
cfe83db0
authored
Oct 29, 2014
by
Joris Vankerschaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix IOError format string when opening non-existent file
parent
376e2b98
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
src/runtime/builtin_modules/builtins.cpp
src/runtime/builtin_modules/builtins.cpp
+1
-1
test/tests/file.py
test/tests/file.py
+5
-0
No files found.
src/runtime/builtin_modules/builtins.cpp
View file @
cfe83db0
...
...
@@ -211,7 +211,7 @@ Box* open(Box* arg1, Box* arg2) {
FILE
*
f
=
fopen
(
fn
.
c_str
(),
mode
.
c_str
());
if
(
!
f
)
raiseExcHelper
(
IOError
,
"
%s: '%s' '%s'"
,
strerror
(
errno
),
fn
.
c_str
());
raiseExcHelper
(
IOError
,
"
[Error %d] %s: '%s'"
,
errno
,
strerror
(
errno
),
fn
.
c_str
());
return
new
BoxedFile
(
f
,
fn
,
mode
);
}
...
...
test/tests/file.py
View file @
cfe83db0
...
...
@@ -39,3 +39,8 @@ with open('../README.md') as f:
print
lines
[:
5
]
print
lines
[
-
5
:]
# Check that opening a non-existent file results in an IOError.
try
:
f
=
open
(
'this-should-definitely-not-exist.txt'
)
except
IOError
as
e
:
print
str
(
e
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment