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
02252480
Commit
02252480
authored
Sep 30, 2008
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Victor Stinner's patches to check the return result of PyLong_Ssize_t
reviewed by Amaury
parent
8d77d448
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
0 deletions
+10
-0
Modules/_bytesio.c
Modules/_bytesio.c
+8
-0
Modules/_struct.c
Modules/_struct.c
+2
-0
No files found.
Modules/_bytesio.c
View file @
02252480
...
...
@@ -221,6 +221,8 @@ bytesio_read(BytesIOObject *self, PyObject *args)
if
(
PyInt_Check
(
arg
))
{
size
=
PyInt_AsSsize_t
(
arg
);
if
(
size
==
-
1
&&
PyErr_Occurred
())
return
NULL
;
}
else
if
(
arg
==
Py_None
)
{
/* Read until EOF is reached, by default. */
...
...
@@ -288,6 +290,8 @@ bytesio_readline(BytesIOObject *self, PyObject *args)
if
(
PyInt_Check
(
arg
))
{
size
=
PyInt_AsSsize_t
(
arg
);
if
(
size
==
-
1
&&
PyErr_Occurred
())
return
NULL
;
}
else
if
(
arg
==
Py_None
)
{
/* No size limit, by default. */
...
...
@@ -332,6 +336,8 @@ bytesio_readlines(BytesIOObject *self, PyObject *args)
if
(
PyInt_Check
(
arg
))
{
maxsize
=
PyInt_AsSsize_t
(
arg
);
if
(
maxsize
==
-
1
&&
PyErr_Occurred
())
return
NULL
;
}
else
if
(
arg
==
Py_None
)
{
/* No size limit, by default. */
...
...
@@ -415,6 +421,8 @@ bytesio_truncate(BytesIOObject *self, PyObject *args)
if
(
PyInt_Check
(
arg
))
{
size
=
PyInt_AsSsize_t
(
arg
);
if
(
size
==
-
1
&&
PyErr_Occurred
())
return
NULL
;
}
else
if
(
arg
==
Py_None
)
{
/* Truncate to current position if no argument is passed. */
...
...
Modules/_struct.c
View file @
02252480
...
...
@@ -1755,6 +1755,8 @@ s_pack_into(PyObject *self, PyObject *args)
/* Extract the offset from the first argument */
offset
=
PyInt_AsSsize_t
(
PyTuple_GET_ITEM
(
args
,
1
));
if
(
offset
==
-
1
&&
PyErr_Occurred
())
return
NULL
;
/* Support negative offsets. */
if
(
offset
<
0
)
...
...
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