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
d063eeb7
Commit
d063eeb7
authored
May 22, 2011
by
Charles-François Natali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #12105: Add O_CLOEXEC to the os module.
parent
1b802471
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
0 deletions
+13
-0
Doc/library/os.rst
Doc/library/os.rst
+1
-0
Lib/test/test_posix.py
Lib/test/test_posix.py
+7
-0
Misc/NEWS
Misc/NEWS
+2
-0
Modules/posixmodule.c
Modules/posixmodule.c
+3
-0
No files found.
Doc/library/os.rst
View file @
d063eeb7
...
@@ -1298,6 +1298,7 @@ or `the MSDN <http://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Window
...
@@ -1298,6 +1298,7 @@ or `the MSDN <http://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx>`_ on Window
O_NOCTTY
O_NOCTTY
O_SHLOCK
O_SHLOCK
O_EXLOCK
O_EXLOCK
O_CLOEXEC
These constants are only available on Unix.
These constants are only available on Unix.
...
...
Lib/test/test_posix.py
View file @
d063eeb7
...
@@ -9,6 +9,7 @@ import errno
...
@@ -9,6 +9,7 @@ import errno
import
sys
import
sys
import
time
import
time
import
os
import
os
import
fcntl
import
pwd
import
pwd
import
shutil
import
shutil
import
stat
import
stat
...
@@ -307,6 +308,12 @@ class PosixTester(unittest.TestCase):
...
@@ -307,6 +308,12 @@ class PosixTester(unittest.TestCase):
fp1
.
close
()
fp1
.
close
()
fp2
.
close
()
fp2
.
close
()
@
unittest
.
skipUnless
(
hasattr
(
os
,
'O_CLOEXEC'
),
"needs os.O_CLOEXEC"
)
def
test_oscloexec
(
self
):
fd
=
os
.
open
(
support
.
TESTFN
,
os
.
O_RDONLY
|
os
.
O_CLOEXEC
)
self
.
addCleanup
(
os
.
close
,
fd
)
self
.
assertTrue
(
fcntl
.
fcntl
(
fd
,
fcntl
.
F_GETFD
)
&
fcntl
.
FD_CLOEXEC
)
def
test_osexlock
(
self
):
def
test_osexlock
(
self
):
if
hasattr
(
posix
,
"O_EXLOCK"
):
if
hasattr
(
posix
,
"O_EXLOCK"
):
fd
=
os
.
open
(
support
.
TESTFN
,
fd
=
os
.
open
(
support
.
TESTFN
,
...
...
Misc/NEWS
View file @
d063eeb7
...
@@ -153,6 +153,8 @@ Core and Builtins
...
@@ -153,6 +153,8 @@ Core and Builtins
Library
Library
-------
-------
- Issue #12105: Add O_CLOEXEC to the os module.
- Issue #12079: Decimal('
Infinity
').fma(Decimal('
0
'), (3.91224318126786e+19+0j))
- Issue #12079: Decimal('
Infinity
').fma(Decimal('
0
'), (3.91224318126786e+19+0j))
now raises TypeError (reflecting the invalid type of the 3rd argument) rather
now raises TypeError (reflecting the invalid type of the 3rd argument) rather
than Decimal.InvalidOperation.
than Decimal.InvalidOperation.
...
...
Modules/posixmodule.c
View file @
d063eeb7
...
@@ -9783,6 +9783,9 @@ all_ins(PyObject *d)
...
@@ -9783,6 +9783,9 @@ all_ins(PyObject *d)
#ifdef PRIO_USER
#ifdef PRIO_USER
if
(
ins
(
d
,
"PRIO_USER"
,
(
long
)
PRIO_USER
))
return
-
1
;
if
(
ins
(
d
,
"PRIO_USER"
,
(
long
)
PRIO_USER
))
return
-
1
;
#endif
#endif
#ifdef O_CLOEXEC
if
(
ins
(
d
,
"O_CLOEXEC"
,
(
long
)
O_CLOEXEC
))
return
-
1
;
#endif
/* posix - constants for *at functions */
/* posix - constants for *at functions */
#ifdef AT_SYMLINK_NOFOLLOW
#ifdef AT_SYMLINK_NOFOLLOW
if
(
ins
(
d
,
"AT_SYMLINK_NOFOLLOW"
,
(
long
)
AT_SYMLINK_NOFOLLOW
))
return
-
1
;
if
(
ins
(
d
,
"AT_SYMLINK_NOFOLLOW"
,
(
long
)
AT_SYMLINK_NOFOLLOW
))
return
-
1
;
...
...
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