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
a54e00aa
Commit
a54e00aa
authored
Jun 11, 2002
by
Skip Montanaro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
patch #562492 - prevent duplicate lines in history
also call using_history() to properly initialize history variables
parent
d93524a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
Modules/readline.c
Modules/readline.c
+19
-2
No files found.
Modules/readline.c
View file @
a54e00aa
...
...
@@ -552,6 +552,8 @@ flex_complete(char *text, int start, int end)
static
void
setup_readline
(
void
)
{
using_history
();
rl_readline_name
=
"python"
;
#if defined(PYOS_OS2) && defined(PYCC_GCC)
/* Allow $if term= in .inputrc to work */
...
...
@@ -628,8 +630,23 @@ call_readline(char *prompt)
return
p
;
}
n
=
strlen
(
p
);
if
(
n
>
0
)
add_history
(
p
);
if
(
n
>
0
)
{
char
*
line
;
HISTORY_STATE
*
state
=
history_get_history_state
();
if
(
state
->
length
>
0
)
line
=
history_get
(
state
->
length
)
->
line
;
else
line
=
""
;
if
(
strcmp
(
p
,
line
))
add_history
(
p
);
/* the history docs don't say so, but the address of state
changes each time history_get_history_state is called
which makes me think it's freshly malloc'd memory...
on the other hand, the address of the last line stays the
same as long as history isn't extended, so it appears to
be malloc'd but managed by the history package... */
free
(
state
);
}
/* Copy the malloc'ed buffer into a PyMem_Malloc'ed one and
release the original. */
q
=
p
;
...
...
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