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
528b559c
Commit
528b559c
authored
Feb 27, 2005
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch #1093585: raise a ValueError for negative history items in
remove_history and replace_history. Will backport to 2.4.
parent
77d2a3a8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
Misc/NEWS
Misc/NEWS
+3
-0
Modules/readline.c
Modules/readline.c
+10
-0
No files found.
Misc/NEWS
View file @
528b559c
...
@@ -34,6 +34,9 @@ Core and builtins
...
@@ -34,6 +34,9 @@ Core and builtins
Extension Modules
Extension Modules
-----------------
-----------------
- Patch #1093585: raise a ValueError for negative history items in readline.
{remove_history,replace_history}
- The spwd module has been added, allowing access to the shadow password
- The spwd module has been added, allowing access to the shadow password
database.
database.
...
...
Modules/readline.c
View file @
528b559c
...
@@ -303,6 +303,11 @@ py_remove_history(PyObject *self, PyObject *args)
...
@@ -303,6 +303,11 @@ py_remove_history(PyObject *self, PyObject *args)
if
(
!
PyArg_ParseTuple
(
args
,
"i:remove_history"
,
&
entry_number
))
if
(
!
PyArg_ParseTuple
(
args
,
"i:remove_history"
,
&
entry_number
))
return
NULL
;
return
NULL
;
if
(
entry_number
<
0
)
{
PyErr_SetString
(
PyExc_ValueError
,
"History index cannot be negative"
);
return
NULL
;
}
entry
=
remove_history
(
entry_number
);
entry
=
remove_history
(
entry_number
);
if
(
!
entry
)
{
if
(
!
entry
)
{
PyErr_Format
(
PyExc_ValueError
,
PyErr_Format
(
PyExc_ValueError
,
...
@@ -335,6 +340,11 @@ py_replace_history(PyObject *self, PyObject *args)
...
@@ -335,6 +340,11 @@ py_replace_history(PyObject *self, PyObject *args)
if
(
!
PyArg_ParseTuple
(
args
,
"is:replace_history"
,
&
entry_number
,
&
line
))
{
if
(
!
PyArg_ParseTuple
(
args
,
"is:replace_history"
,
&
entry_number
,
&
line
))
{
return
NULL
;
return
NULL
;
}
}
if
(
entry_number
<
0
)
{
PyErr_SetString
(
PyExc_ValueError
,
"History index cannot be negative"
);
return
NULL
;
}
old_entry
=
replace_history_entry
(
entry_number
,
line
,
(
void
*
)
NULL
);
old_entry
=
replace_history_entry
(
entry_number
,
line
,
(
void
*
)
NULL
);
if
(
!
old_entry
)
{
if
(
!
old_entry
)
{
PyErr_Format
(
PyExc_ValueError
,
PyErr_Format
(
PyExc_ValueError
,
...
...
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