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
29e49d63
Commit
29e49d63
authored
Jul 19, 2012
by
Meador Inge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #15394: Fix ref leaks in PyModule_Create.
Patch by Julia Lawall.
parent
60c2266a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
Objects/moduleobject.c
Objects/moduleobject.c
+7
-1
No files found.
Misc/ACKS
View file @
29e49d63
...
...
@@ -542,6 +542,7 @@ Soren Larsen
Piers Lauder
Ben Laurie
Simon Law
Julia Lawall
Chris Lawrence
Brian Leair
James Lee
...
...
Misc/NEWS
View file @
29e49d63
...
...
@@ -10,6 +10,9 @@ What's New in Python 3.2.4
Core and Builtins
-----------------
- Issue #15394: An issue in PyModule_Create that caused references to
be leaked on some error paths has been fixed. Patch by Julia Lawall.
- Issue #15368: An issue that caused bytecode generation to be
non-deterministic when using randomized hashing (-R) has been fixed.
...
...
Objects/moduleobject.c
View file @
29e49d63
...
...
@@ -117,8 +117,10 @@ PyModule_Create2(struct PyModuleDef* module, int module_api_version)
d
=
PyModule_GetDict
((
PyObject
*
)
m
);
if
(
module
->
m_methods
!=
NULL
)
{
n
=
PyUnicode_FromString
(
name
);
if
(
n
==
NULL
)
if
(
n
==
NULL
)
{
Py_DECREF
(
m
);
return
NULL
;
}
for
(
ml
=
module
->
m_methods
;
ml
->
ml_name
!=
NULL
;
ml
++
)
{
if
((
ml
->
ml_flags
&
METH_CLASS
)
||
(
ml
->
ml_flags
&
METH_STATIC
))
{
...
...
@@ -126,16 +128,19 @@ PyModule_Create2(struct PyModuleDef* module, int module_api_version)
"module functions cannot set"
" METH_CLASS or METH_STATIC"
);
Py_DECREF
(
n
);
Py_DECREF
(
m
);
return
NULL
;
}
v
=
PyCFunction_NewEx
(
ml
,
(
PyObject
*
)
m
,
n
);
if
(
v
==
NULL
)
{
Py_DECREF
(
n
);
Py_DECREF
(
m
);
return
NULL
;
}
if
(
PyDict_SetItemString
(
d
,
ml
->
ml_name
,
v
)
!=
0
)
{
Py_DECREF
(
v
);
Py_DECREF
(
n
);
Py_DECREF
(
m
);
return
NULL
;
}
Py_DECREF
(
v
);
...
...
@@ -146,6 +151,7 @@ PyModule_Create2(struct PyModuleDef* module, int module_api_version)
v
=
PyUnicode_FromString
(
module
->
m_doc
);
if
(
v
==
NULL
||
PyDict_SetItemString
(
d
,
"__doc__"
,
v
)
!=
0
)
{
Py_XDECREF
(
v
);
Py_DECREF
(
m
);
return
NULL
;
}
Py_DECREF
(
v
);
...
...
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