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
2e7cb1ed
Commit
2e7cb1ed
authored
Jun 03, 2016
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Plain Diff
Merge heads
parents
a9e6edaf
194a4a24
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
9 deletions
+51
-9
Doc/library/fcntl.rst
Doc/library/fcntl.rst
+3
-1
Doc/library/sqlite3.rst
Doc/library/sqlite3.rst
+5
-0
Doc/library/termios.rst
Doc/library/termios.rst
+4
-4
Lib/subprocess.py
Lib/subprocess.py
+15
-4
Lib/test/test_subprocess.py
Lib/test/test_subprocess.py
+21
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Doc/library/fcntl.rst
View file @
2e7cb1ed
...
...
@@ -12,7 +12,9 @@
pair: UNIX; I/O control
This module performs file control and I/O control on file descriptors. It is an
interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines.
interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. For a
complete description of these calls, see :manpage:`fcntl(2)` and
:manpage:`ioctl(2)` Unix manual pages.
All functions in this module take a file descriptor *fd* as their first
argument. This can be an integer file descriptor, such as returned by
...
...
Doc/library/sqlite3.rst
View file @
2e7cb1ed
...
...
@@ -190,6 +190,11 @@ Module functions and constants
any combination of :const:`PARSE_DECLTYPES` and :const:`PARSE_COLNAMES` to turn
type detection on.
By default, *check_same_thread* is :const:`True` and only the creating thread may
use the connection. If set :const:`False`, the returned connection may be shared
across multiple threads. When using multiple threads with the same connection
writing operations should be serialized by the user to avoid data corruption.
By default, the :mod:`sqlite3` module uses its :class:`Connection` class for the
connect call. You can, however, subclass the :class:`Connection` class and make
:func:`connect` use your class instead by providing your class for the *factory*
...
...
Doc/library/termios.rst
View file @
2e7cb1ed
...
...
@@ -10,10 +10,10 @@
pair: POSIX; I/O control
pair: tty; I/O control
This module provides an interface to the POSIX calls for tty I/O control.
For a
complete description of these calls, see
the POSIX or Unix manual pages. It is
only available for those Unix versions that support POSIX *termios* style tty
I/O control (and then only if configured at installation time)
.
This module provides an interface to the POSIX calls for tty I/O control. For a
complete description of these calls, see
:manpage:`termios(2)` Unix manual
page. It is only available for those Unix versions that support POSIX
*termios* style tty I/O control configured during installation
.
All functions in this module take a file descriptor *fd* as their first
argument. This can be an integer file descriptor, such as returned by
...
...
Lib/subprocess.py
View file @
2e7cb1ed
...
...
@@ -372,9 +372,11 @@ class SubprocessError(Exception): pass
class
CalledProcessError
(
SubprocessError
):
"""This exception is raised when a process run by check_call() or
check_output() returns a non-zero exit status.
The exit status will be stored in the returncode attribute;
"""Raised when a check_call() or check_output() process returns non-zero.
The exit status will be stored in the returncode attribute, negative
if it represents a signal number.
check_output() will also store the output in the output attribute.
"""
def
__init__
(
self
,
returncode
,
cmd
,
output
=
None
,
stderr
=
None
):
...
...
@@ -384,7 +386,16 @@ class CalledProcessError(SubprocessError):
self
.
stderr
=
stderr
def
__str__
(
self
):
return
"Command '%s' returned non-zero exit status %d"
%
(
self
.
cmd
,
self
.
returncode
)
if
self
.
returncode
and
self
.
returncode
<
0
:
try
:
return
"Command '%s' died with %r."
%
(
self
.
cmd
,
signal
.
Signals
(
-
self
.
returncode
))
except
ValueError
:
return
"Command '%s' died with unknown signal %d."
%
(
self
.
cmd
,
-
self
.
returncode
)
else
:
return
"Command '%s' returned non-zero exit status %d."
%
(
self
.
cmd
,
self
.
returncode
)
@
property
def
stdout
(
self
):
...
...
Lib/test/test_subprocess.py
View file @
2e7cb1ed
...
...
@@ -1427,6 +1427,27 @@ class POSIXProcessTestCase(BaseTestCase):
p
.
wait
()
self
.
assertEqual
(
-
p
.
returncode
,
signal
.
SIGABRT
)
def
test_CalledProcessError_str_signal
(
self
):
err
=
subprocess
.
CalledProcessError
(
-
int
(
signal
.
SIGABRT
),
"fake cmd"
)
error_string
=
str
(
err
)
# We're relying on the repr() of the signal.Signals intenum to provide
# the word signal, the signal name and the numeric value.
self
.
assertIn
(
"signal"
,
error_string
.
lower
())
# We're not being specific about the signal name as some signals have
# multiple names and which name is revealed can vary.
self
.
assertIn
(
"SIG"
,
error_string
)
self
.
assertIn
(
str
(
signal
.
SIGABRT
),
error_string
)
def
test_CalledProcessError_str_unknown_signal
(
self
):
err
=
subprocess
.
CalledProcessError
(
-
9876543
,
"fake cmd"
)
error_string
=
str
(
err
)
self
.
assertIn
(
"unknown signal 9876543."
,
error_string
)
def
test_CalledProcessError_str_non_zero
(
self
):
err
=
subprocess
.
CalledProcessError
(
2
,
"fake cmd"
)
error_string
=
str
(
err
)
self
.
assertIn
(
"non-zero exit status 2."
,
error_string
)
def
test_preexec
(
self
):
# DISCLAIMER: Setting environment variables is *not* a good use
# of a preexec_fn. This is merely a test.
...
...
Misc/NEWS
View file @
2e7cb1ed
...
...
@@ -22,6 +22,9 @@ Core and Builtins
Library
-------
- Issue #27167: Clarify the subprocess.CalledProcessError error message text
when the child process died due to a signal.
- Issue #25931: Don'
t
define
socketserver
.
Forking
*
names
on
platforms
such
as
Windows
that
do
not
support
os
.
fork
().
...
...
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