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
b2653b34
Commit
b2653b34
authored
Jan 18, 2015
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #23098: 64-bit dev_t is now supported in the os module.
parent
ccb416fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
12 deletions
+34
-12
Misc/NEWS
Misc/NEWS
+2
-0
Modules/posixmodule.c
Modules/posixmodule.c
+32
-12
No files found.
Misc/NEWS
View file @
b2653b34
...
...
@@ -44,6 +44,8 @@ Core and Builtins
Library
-------
- Issue #23098: 64-bit dev_t is now supported in the os module.
- Issue #23250: In the http.cookies module, capitalize "HttpOnly" and "Secure"
as they are written in the standard.
...
...
Modules/posixmodule.c
View file @
b2653b34
...
...
@@ -623,6 +623,29 @@ fail:
#endif
/* MS_WINDOWS */
#if defined(HAVE_MKNOD) && defined(HAVE_MAKEDEV)
static
int
_Py_Dev_Converter
(
PyObject
*
obj
,
void
*
p
)
{
#ifdef HAVE_LONG_LONG
*
((
dev_t
*
)
p
)
=
PyLong_AsUnsignedLongLong
(
obj
);
#else
*
((
dev_t
*
)
p
)
=
PyLong_AsUnsignedLong
(
obj
);
#endif
if
(
PyErr_Occurred
())
return
0
;
return
1
;
}
#ifdef HAVE_LONG_LONG
# define _PyLong_FromDev PyLong_FromLongLong
#else
# define _PyLong_FromDev PyLong_FromLong
#endif
#endif
#ifdef AT_FDCWD
/*
* Why the (int) cast? Solaris 10 defines AT_FDCWD as 0xffd19553 (-3041965);
...
...
@@ -2218,11 +2241,8 @@ _pystat_fromstructstat(STRUCT_STAT *st)
#endif
#ifdef MS_WINDOWS
PyStructSequence_SET_ITEM
(
v
,
2
,
PyLong_FromUnsignedLong
(
st
->
st_dev
));
#elif defined(HAVE_LONG_LONG)
PyStructSequence_SET_ITEM
(
v
,
2
,
PyLong_FromLongLong
((
PY_LONG_LONG
)
st
->
st_dev
));
#else
PyStructSequence_SET_ITEM
(
v
,
2
,
PyLong_FromLong
((
long
)
st
->
st_dev
));
PyStructSequence_SET_ITEM
(
v
,
2
,
_PyLong_FromDev
(
st
->
st_dev
));
#endif
PyStructSequence_SET_ITEM
(
v
,
3
,
PyLong_FromLong
((
long
)
st
->
st_nlink
));
#if defined(MS_WINDOWS)
...
...
@@ -8633,16 +8653,16 @@ posix_mknod(PyObject *self, PyObject *args, PyObject *kwargs)
{
path_t
path
;
int
mode
=
0666
;
in
t
device
=
0
;
dev_
t
device
=
0
;
int
dir_fd
=
DEFAULT_DIR_FD
;
int
result
;
PyObject
*
return_value
=
NULL
;
static
char
*
keywords
[]
=
{
"path"
,
"mode"
,
"device"
,
"dir_fd"
,
NULL
};
memset
(
&
path
,
0
,
sizeof
(
path
));
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"O&|i
i
$O&:mknod"
,
keywords
,
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwargs
,
"O&|i
O&
$O&:mknod"
,
keywords
,
path_converter
,
&
path
,
&
mode
,
&
device
,
&
mode
,
_Py_Dev_Converter
,
&
device
,
#ifdef HAVE_MKNODAT
dir_fd_converter
,
&
dir_fd
#else
...
...
@@ -8682,8 +8702,8 @@ Extracts a device major number from a raw device number.");
static
PyObject
*
posix_major
(
PyObject
*
self
,
PyObject
*
args
)
{
in
t
device
;
if
(
!
PyArg_ParseTuple
(
args
,
"
i:major"
,
&
device
))
dev_
t
device
;
if
(
!
PyArg_ParseTuple
(
args
,
"
O&:major"
,
_Py_Dev_Converter
,
&
device
))
return
NULL
;
return
PyLong_FromLong
((
long
)
major
(
device
));
}
...
...
@@ -8695,8 +8715,8 @@ Extracts a device minor number from a raw device number.");
static
PyObject
*
posix_minor
(
PyObject
*
self
,
PyObject
*
args
)
{
in
t
device
;
if
(
!
PyArg_ParseTuple
(
args
,
"
i:minor"
,
&
device
))
dev_
t
device
;
if
(
!
PyArg_ParseTuple
(
args
,
"
O&:minor"
,
_Py_Dev_Converter
,
&
device
))
return
NULL
;
return
PyLong_FromLong
((
long
)
minor
(
device
));
}
...
...
@@ -8711,7 +8731,7 @@ posix_makedev(PyObject *self, PyObject *args)
int
major
,
minor
;
if
(
!
PyArg_ParseTuple
(
args
,
"ii:makedev"
,
&
major
,
&
minor
))
return
NULL
;
return
PyLong_FromLong
((
long
)
makedev
(
major
,
minor
));
return
_PyLong_FromDev
(
makedev
(
major
,
minor
));
}
#endif
/* device macros */
...
...
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