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
50be1ca5
Commit
50be1ca5
authored
Nov 01, 2010
by
Brian Curtin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some ResourceErrors.
Use a context manager for os.popen and explicitly close a socket.
parent
d4694ed1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
Lib/multiprocessing/__init__.py
Lib/multiprocessing/__init__.py
+2
-1
Lib/test/test_multiprocessing.py
Lib/test/test_multiprocessing.py
+5
-1
No files found.
Lib/multiprocessing/__init__.py
View file @
50be1ca5
...
...
@@ -115,7 +115,8 @@ def cpu_count():
num
=
0
elif
'bsd'
in
sys
.
platform
or
sys
.
platform
==
'darwin'
:
try
:
num
=
int
(
os
.
popen
(
'sysctl -n hw.ncpu'
).
read
())
with
os
.
popen
(
'sysctl -n hw.ncpu'
)
as
p
:
num
=
int
(
p
.
read
())
except
ValueError
:
num
=
0
else
:
...
...
Lib/test/test_multiprocessing.py
View file @
50be1ca5
...
...
@@ -1260,7 +1260,11 @@ class _TestManagerRestart(BaseTestCase):
authkey
=
os
.
urandom
(
32
)
manager
=
QueueManager
(
address
=
(
'localhost'
,
0
),
authkey
=
authkey
,
serializer
=
SERIALIZER
)
addr
=
manager
.
get_server
().
address
srvr
=
manager
.
get_server
()
addr
=
srvr
.
address
# Close the connection.Listener socket which gets opened as a part
# of manager.get_server(). It's not needed for the test.
srvr
.
listener
.
close
()
manager
.
start
()
p
=
self
.
Process
(
target
=
self
.
_putter
,
args
=
(
manager
.
address
,
authkey
))
...
...
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