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
d4efbf90
Commit
d4efbf90
authored
Aug 11, 2010
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use pep 383 decoding for mknod and mkfifo #9570
Patch by David Watson.
parent
f0f45142
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
Misc/NEWS
Misc/NEWS
+2
-0
Modules/posixmodule.c
Modules/posixmodule.c
+10
-2
No files found.
Misc/NEWS
View file @
d4efbf90
...
@@ -30,6 +30,8 @@ Core and Builtins
...
@@ -30,6 +30,8 @@ Core and Builtins
Extensions
Extensions
----------
----------
- Issue #9570: Use PEP 383 decoding in os.mknod and os.mkfifo.
- Issue #6915: Under Windows, os.listdir() didn't release the Global
- Issue #6915: Under Windows, os.listdir() didn't release the Global
Interpreter Lock around all system calls. Original patch by Ryan Kelly.
Interpreter Lock around all system calls. Original patch by Ryan Kelly.
...
...
Modules/posixmodule.c
View file @
d4efbf90
...
@@ -5702,14 +5702,18 @@ Create a FIFO (a POSIX named pipe).");
...
@@ -5702,14 +5702,18 @@ Create a FIFO (a POSIX named pipe).");
static
PyObject
*
static
PyObject
*
posix_mkfifo
(
PyObject
*
self
,
PyObject
*
args
)
posix_mkfifo
(
PyObject
*
self
,
PyObject
*
args
)
{
{
PyObject
*
opath
;
char
*
filename
;
char
*
filename
;
int
mode
=
0666
;
int
mode
=
0666
;
int
res
;
int
res
;
if
(
!
PyArg_ParseTuple
(
args
,
"s|i:mkfifo"
,
&
filename
,
&
mode
))
if
(
!
PyArg_ParseTuple
(
args
,
"O&|i:mkfifo"
,
PyUnicode_FSConverter
,
&
opath
,
&
mode
))
return
NULL
;
return
NULL
;
filename
=
PyBytes_AS_STRING
(
opath
);
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
res
=
mkfifo
(
filename
,
mode
);
res
=
mkfifo
(
filename
,
mode
);
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
Py_DECREF
(
opath
);
if
(
res
<
0
)
if
(
res
<
0
)
return
posix_error
();
return
posix_error
();
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
...
@@ -5732,15 +5736,19 @@ os.makedev()), otherwise it is ignored.");
...
@@ -5732,15 +5736,19 @@ os.makedev()), otherwise it is ignored.");
static
PyObject
*
static
PyObject
*
posix_mknod
(
PyObject
*
self
,
PyObject
*
args
)
posix_mknod
(
PyObject
*
self
,
PyObject
*
args
)
{
{
PyObject
*
opath
;
char
*
filename
;
char
*
filename
;
int
mode
=
0600
;
int
mode
=
0600
;
int
device
=
0
;
int
device
=
0
;
int
res
;
int
res
;
if
(
!
PyArg_ParseTuple
(
args
,
"s|ii:mknod"
,
&
filename
,
&
mode
,
&
device
))
if
(
!
PyArg_ParseTuple
(
args
,
"O&|ii:mknod"
,
PyUnicode_FSConverter
,
&
opath
,
&
mode
,
&
device
))
return
NULL
;
return
NULL
;
filename
=
PyBytes_AS_STRING
(
opath
);
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
res
=
mknod
(
filename
,
mode
,
device
);
res
=
mknod
(
filename
,
mode
,
device
);
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
Py_DECREF
(
opath
);
if
(
res
<
0
)
if
(
res
<
0
)
return
posix_error
();
return
posix_error
();
Py_INCREF
(
Py_None
);
Py_INCREF
(
Py_None
);
...
...
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