Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Kirill Smelkov
cpython
Commits
febd551b
Commit
febd551b
authored
Mar 04, 1992
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change error handling. Call clearerr() more often.
parent
299a7347
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
15 deletions
+11
-15
Objects/fileobject.c
Objects/fileobject.c
+11
-15
No files found.
Objects/fileobject.c
View file @
febd551b
...
...
@@ -164,11 +164,8 @@ file_close(f, args)
sts
=
(
*
f
->
f_close
)(
f
->
f_fp
);
f
->
f_fp
=
NULL
;
}
if
(
sts
==
EOF
)
{
if
(
errno
==
0
)
errno
=
EIO
;
if
(
sts
==
EOF
)
return
err_errno
(
IOError
);
}
if
(
sts
!=
0
)
return
newintobject
((
long
)
sts
);
INCREF
(
None
);
...
...
@@ -197,9 +194,9 @@ file_seek(f, args)
}
errno
=
0
;
if
(
fseek
(
f
->
f_fp
,
offset
,
(
int
)
whence
)
!=
0
)
{
if
(
errno
==
0
)
errno
=
EIO
;
return
err_errno
(
IOError
)
;
err_errno
(
IOError
);
clearerr
(
f
->
f_fp
)
;
return
NULL
;
}
INCREF
(
None
);
return
None
;
...
...
@@ -218,9 +215,9 @@ file_tell(f, args)
errno
=
0
;
offset
=
ftell
(
f
->
f_fp
);
if
(
offset
==
-
1L
)
{
if
(
errno
==
0
)
errno
=
EIO
;
return
err_errno
(
IOError
)
;
err_errno
(
IOError
);
clearerr
(
f
->
f_fp
)
;
return
NULL
;
}
return
newintobject
(
offset
);
}
...
...
@@ -236,9 +233,9 @@ file_flush(f, args)
}
errno
=
0
;
if
(
fflush
(
f
->
f_fp
)
!=
0
)
{
if
(
errno
==
0
)
errno
=
EIO
;
return
err_errno
(
IOError
)
;
err_errno
(
IOError
);
clearerr
(
f
->
f_fp
)
;
return
NULL
;
}
INCREF
(
None
);
return
None
;
...
...
@@ -455,9 +452,8 @@ file_write(f, args)
errno
=
0
;
n2
=
fwrite
(
getstringvalue
(
args
),
1
,
n
=
getstringsize
(
args
),
f
->
f_fp
);
if
(
n2
!=
n
)
{
if
(
errno
==
0
)
errno
=
EIO
;
err_errno
(
IOError
);
clearerr
(
f
->
f_fp
);
return
NULL
;
}
INCREF
(
None
);
...
...
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