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
1241ad86
Commit
1241ad86
authored
Jun 15, 2013
by
Andrew Kuchling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#18113: Objects associated to a curses.panel object with set_userptr() were leaked.
Reported by Atsuo Ishimoto.
parent
d8568174
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
0 deletions
+20
-0
Lib/test/test_curses.py
Lib/test/test_curses.py
+13
-0
Misc/NEWS
Misc/NEWS
+3
-0
Modules/_curses_panel.c
Modules/_curses_panel.c
+4
-0
No files found.
Lib/test/test_curses.py
View file @
1241ad86
...
@@ -250,6 +250,18 @@ def test_userptr_without_set(stdscr):
...
@@ -250,6 +250,18 @@ def test_userptr_without_set(stdscr):
except
curses
.
panel
.
error
:
except
curses
.
panel
.
error
:
pass
pass
def
test_userptr_memory_leak
(
stdscr
):
w
=
curses
.
newwin
(
10
,
10
)
p
=
curses
.
panel
.
new_panel
(
w
)
obj
=
object
()
nrefs
=
sys
.
getrefcount
(
obj
)
for
i
in
range
(
100
):
p
.
set_userptr
(
obj
)
p
.
set_userptr
(
None
)
if
sys
.
getrefcount
(
obj
)
!=
nrefs
:
raise
RuntimeError
,
"set_userptr leaked references"
def
test_resize_term
(
stdscr
):
def
test_resize_term
(
stdscr
):
if
hasattr
(
curses
,
'resizeterm'
):
if
hasattr
(
curses
,
'resizeterm'
):
lines
,
cols
=
curses
.
LINES
,
curses
.
COLS
lines
,
cols
=
curses
.
LINES
,
curses
.
COLS
...
@@ -268,6 +280,7 @@ def main(stdscr):
...
@@ -268,6 +280,7 @@ def main(stdscr):
module_funcs
(
stdscr
)
module_funcs
(
stdscr
)
window_funcs
(
stdscr
)
window_funcs
(
stdscr
)
test_userptr_without_set
(
stdscr
)
test_userptr_without_set
(
stdscr
)
test_userptr_memory_leak
(
stdscr
)
test_resize_term
(
stdscr
)
test_resize_term
(
stdscr
)
test_issue6243
(
stdscr
)
test_issue6243
(
stdscr
)
finally
:
finally
:
...
...
Misc/NEWS
View file @
1241ad86
...
@@ -40,6 +40,9 @@ Library
...
@@ -40,6 +40,9 @@ Library
the default for linking if LDSHARED is not also overriden. This restores
the default for linking if LDSHARED is not also overriden. This restores
Distutils behavior introduced in 2.7.3 and inadvertently dropped in 2.7.4.
Distutils behavior introduced in 2.7.3 and inadvertently dropped in 2.7.4.
- Issue #18113: Fixed a refcount leak in the curses.panel module'
s
set_userptr
()
method
.
Reported
by
Atsuo
Ishimoto
.
Build
Build
-----
-----
...
...
Modules/_curses_panel.c
View file @
1241ad86
...
@@ -293,6 +293,10 @@ PyCursesPanel_replace_panel(PyCursesPanelObject *self, PyObject *args)
...
@@ -293,6 +293,10 @@ PyCursesPanel_replace_panel(PyCursesPanelObject *self, PyObject *args)
static
PyObject
*
static
PyObject
*
PyCursesPanel_set_panel_userptr
(
PyCursesPanelObject
*
self
,
PyObject
*
obj
)
PyCursesPanel_set_panel_userptr
(
PyCursesPanelObject
*
self
,
PyObject
*
obj
)
{
{
PyObject
*
oldobj
;
PyCursesInitialised
;
oldobj
=
(
PyObject
*
)
panel_userptr
(
self
->
pan
);
Py_XDECREF
(
oldobj
);
Py_INCREF
(
obj
);
Py_INCREF
(
obj
);
return
PyCursesCheckERR
(
set_panel_userptr
(
self
->
pan
,
(
void
*
)
obj
),
return
PyCursesCheckERR
(
set_panel_userptr
(
self
->
pan
,
(
void
*
)
obj
),
"set_panel_userptr"
);
"set_panel_userptr"
);
...
...
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