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
3261d005
Commit
3261d005
authored
Jun 06, 2011
by
Charles-François Natali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #12196: Make os.pipe2() flags argument mandatory.
parent
3b6a4b1a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
13 deletions
+14
-13
Doc/library/os.rst
Doc/library/os.rst
+3
-3
Lib/test/test_posix.py
Lib/test/test_posix.py
+2
-2
Modules/posixmodule.c
Modules/posixmodule.c
+9
-8
No files found.
Doc/library/os.rst
View file @
3261d005
...
...
@@ -1019,11 +1019,11 @@ as internal buffering of data.
Availability: Unix, Windows.
.. function:: pipe2(flags
=0
)
.. function:: pipe2(flags)
Create a pipe with *flags* set atomically.
*flags*
is optional and can be constructed by ORing together zero or more of
these values:
:data:`O_NONBLOCK`, :data:`O_CLOEXEC`.
*flags*
can be constructed by ORing together one or more of these values:
:data:`O_NONBLOCK`, :data:`O_CLOEXEC`.
Return a pair of file descriptors ``(r, w)`` usable for reading and writing,
respectively.
...
...
Lib/test/test_posix.py
View file @
3261d005
...
...
@@ -481,8 +481,8 @@ class PosixTester(unittest.TestCase):
self
.
assertRaises
(
TypeError
,
os
.
pipe2
,
'DEADBEEF'
)
self
.
assertRaises
(
TypeError
,
os
.
pipe2
,
0
,
0
)
# try calling with
out flag
, like os.pipe()
r
,
w
=
os
.
pipe2
()
# try calling with
flags = 0
, like os.pipe()
r
,
w
=
os
.
pipe2
(
0
)
os
.
close
(
r
)
os
.
close
(
w
)
...
...
Modules/posixmodule.c
View file @
3261d005
...
...
@@ -6549,20 +6549,21 @@ posix_pipe(PyObject *self, PyObject *noargs)
#ifdef HAVE_PIPE2
PyDoc_STRVAR
(
posix_pipe2__doc__
,
"pipe2(flags
=0
) -> (read_end, write_end)
\n\n
\
Create a pipe with flags set atomically.\
flags
is optional and can be constructed by ORing together zero or more
\n
\
of these values:
O_NONBLOCK, O_CLOEXEC.
\n
\
"pipe2(flags) -> (read_end, write_end)
\n\n
\
Create a pipe with flags set atomically.
\
n
\
flags
can be constructed by ORing together one or more of these values:
\n
\
O_NONBLOCK, O_CLOEXEC.
\n
\
"
);
static
PyObject
*
posix_pipe2
(
PyObject
*
self
,
PyObject
*
arg
s
)
posix_pipe2
(
PyObject
*
self
,
PyObject
*
arg
)
{
int
flags
=
0
;
int
flags
;
int
fds
[
2
];
int
res
;
if
(
!
PyArg_ParseTuple
(
args
,
"|i:pipe2"
,
&
flags
))
flags
=
PyLong_AsLong
(
arg
);
if
(
flags
==
-
1
&&
PyErr_Occurred
())
return
NULL
;
res
=
pipe2
(
fds
,
flags
);
...
...
@@ -9467,7 +9468,7 @@ static PyMethodDef posix_methods[] = {
{
"pipe"
,
posix_pipe
,
METH_NOARGS
,
posix_pipe__doc__
},
#endif
#ifdef HAVE_PIPE2
{
"pipe2"
,
posix_pipe2
,
METH_
VARARGS
,
posix_pipe2__doc__
},
{
"pipe2"
,
posix_pipe2
,
METH_
O
,
posix_pipe2__doc__
},
#endif
#ifdef HAVE_MKFIFO
{
"mkfifo"
,
posix_mkfifo
,
METH_VARARGS
,
posix_mkfifo__doc__
},
...
...
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