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
4e9da0d1
Commit
4e9da0d1
authored
Feb 02, 2018
by
Eric Snow
Committed by
GitHub
Feb 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-32604: Fix memory leaks in the new _xxsubinterpreters module. (#5507)
parent
2f79c014
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
607 additions
and
276 deletions
+607
-276
Lib/test/test__xxsubinterpreters.py
Lib/test/test__xxsubinterpreters.py
+10
-8
Modules/_xxsubinterpretersmodule.c
Modules/_xxsubinterpretersmodule.c
+596
-268
Python/pystate.c
Python/pystate.c
+1
-0
No files found.
Lib/test/test__xxsubinterpreters.py
View file @
4e9da0d1
...
...
@@ -362,13 +362,15 @@ class DestroyTests(TestBase):
def
test_from_current
(
self
):
main
,
=
interpreters
.
list_all
()
id
=
interpreters
.
create
()
script
=
dedent
(
"""
script
=
dedent
(
f
"""
import _xxsubinterpreters as _interpreters
_interpreters.destroy({})
"""
).
format
(
id
)
try:
_interpreters.destroy(
{
id
}
)
except RuntimeError:
pass
"""
)
with
self
.
assertRaises
(
RuntimeError
):
interpreters
.
run_string
(
id
,
script
)
interpreters
.
run_string
(
id
,
script
)
self
.
assertEqual
(
set
(
interpreters
.
list_all
()),
{
main
,
id
})
def
test_from_sibling
(
self
):
...
...
@@ -761,12 +763,12 @@ class ChannelIDTests(TestBase):
self
.
assertEqual
(
int
(
cid
),
10
)
def
test_bad_id
(
self
):
ids
=
[
-
1
,
2
**
64
,
"spam"
]
for
cid
in
ids
:
for
cid
in
[
-
1
,
'spam'
]:
with
self
.
subTest
(
cid
):
with
self
.
assertRaises
(
ValueError
):
interpreters
.
_channel_id
(
cid
)
with
self
.
assertRaises
(
OverflowError
):
interpreters
.
_channel_id
(
2
**
64
)
with
self
.
assertRaises
(
TypeError
):
interpreters
.
_channel_id
(
object
())
...
...
Modules/_xxsubinterpretersmodule.c
View file @
4e9da0d1
This diff is collapsed.
Click to expand it.
Python/pystate.c
View file @
4e9da0d1
...
...
@@ -1242,6 +1242,7 @@ _PyCrossInterpreterData_Lookup(PyObject *obj)
break
;
}
}
Py_DECREF
(
cls
);
PyThread_release_lock
(
_PyRuntime
.
xidregistry
.
mutex
);
return
getdata
;
}
...
...
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