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
8b59c23a
Commit
8b59c23a
authored
Dec 10, 2011
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
you can't get resource.error if you can't import resource
parent
97c9428c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
11 deletions
+16
-11
Lib/test/test_subprocess.py
Lib/test/test_subprocess.py
+16
-11
No files found.
Lib/test/test_subprocess.py
View file @
8b59c23a
...
...
@@ -10,6 +10,11 @@ import time
import
re
import
sysconfig
try
:
import
resource
except
ImportError
:
resource
=
None
mswindows
=
(
sys
.
platform
==
"win32"
)
#
...
...
@@ -633,12 +638,12 @@ class _SuppressCoreFiles(object):
def
__enter__
(
self
):
"""Try to save previous ulimit, then set it to (0, 0)."""
try
:
import
resource
self
.
old_limit
=
resource
.
getrlimit
(
resource
.
RLIMIT_CORE
)
resource
.
setrlimit
(
resource
.
RLIMIT_CORE
,
(
0
,
0
))
except
(
ImportError
,
ValueError
,
resource
.
error
):
pass
if
resource
is
not
None
:
try
:
self
.
old_limit
=
resource
.
getrlimit
(
resource
.
RLIMIT_CORE
)
resource
.
setrlimit
(
resource
.
RLIMIT_CORE
,
(
0
,
0
))
except
(
ValueError
,
resource
.
error
):
pass
if
sys
.
platform
==
'darwin'
:
# Check if the 'Crash Reporter' on OSX was configured
...
...
@@ -658,11 +663,11 @@ class _SuppressCoreFiles(object):
"""Return core file behavior to default."""
if
self
.
old_limit
is
None
:
return
try
:
import
resource
resource
.
setrlimit
(
resource
.
RLIMIT_CORE
,
self
.
old_limit
)
except
(
ImportError
,
ValueError
,
resource
.
error
):
pass
if
resource
is
not
None
:
try
:
resource
.
setrlimit
(
resource
.
RLIMIT_CORE
,
self
.
old_limit
)
except
(
ValueError
,
resource
.
error
):
pass
@
unittest
.
skipUnless
(
hasattr
(
signal
,
'SIGALRM'
),
"Requires signal.SIGALRM"
)
...
...
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