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
117d7b29
Commit
117d7b29
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
01f8bcf9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
12 deletions
+44
-12
Misc/NEWS
Misc/NEWS
+2
-0
Modules/posixmodule.c
Modules/posixmodule.c
+42
-12
No files found.
Misc/NEWS
View file @
117d7b29
...
...
@@ -15,6 +15,8 @@ Core and Builtins
Library
-------
- Issue #23098: 64-bit dev_t is now supported in the os module.
- Issue #23063: In the disutils'
check
command
,
fix
parsing
of
reST
with
code
or
code
-
block
directives
.
...
...
Modules/posixmodule.c
View file @
117d7b29
...
...
@@ -474,6 +474,36 @@ OverflowUp:
#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
static
PyObject
*
_PyInt_FromDev
(
PY_LONG_LONG
v
)
{
if
(
LONG_MIN
<=
v
&&
v
<=
LONG_MAX
)
return
PyInt_FromLong
((
long
)
v
);
else
return
PyLong_FromLongLong
(
v
);
}
#else
# define _PyInt_FromDev PyInt_FromLong
#endif
#endif
#if defined _MSC_VER && _MSC_VER >= 1400
/* Microsoft CRT in VS2005 and higher will verify that a filehandle is
* valid and raise an assertion if it isn't.
...
...
@@ -1426,11 +1456,10 @@ _pystat_fromstructstat(STRUCT_STAT *st)
#else
PyStructSequence_SET_ITEM
(
v
,
1
,
PyInt_FromLong
((
long
)
st
->
st_ino
));
#endif
#if defined(HAVE_LONG_LONG) && !defined(MS_WINDOWS)
PyStructSequence_SET_ITEM
(
v
,
2
,
PyLong_FromLongLong
((
PY_LONG_LONG
)
st
->
st_dev
));
#ifdef MS_WINDOWS
PyStructSequence_SET_ITEM
(
v
,
2
,
PyLong_FromUnsignedLong
(
st
->
st_dev
));
#else
PyStructSequence_SET_ITEM
(
v
,
2
,
PyInt_FromLong
((
long
)
st
->
st_dev
));
PyStructSequence_SET_ITEM
(
v
,
2
,
_PyInt_FromDev
(
st
->
st_dev
));
#endif
PyStructSequence_SET_ITEM
(
v
,
3
,
PyInt_FromLong
((
long
)
st
->
st_nlink
));
#if defined(MS_WINDOWS)
...
...
@@ -7009,9 +7038,11 @@ posix_mknod(PyObject *self, PyObject *args)
{
char
*
filename
;
int
mode
=
0600
;
in
t
device
=
0
;
dev_
t
device
=
0
;
int
res
;
if
(
!
PyArg_ParseTuple
(
args
,
"s|ii:mknod"
,
&
filename
,
&
mode
,
&
device
))
if
(
!
PyArg_ParseTuple
(
args
,
"s|iO&:mknod"
,
&
filename
,
&
mode
,
_Py_Dev_Converter
,
&
device
))
return
NULL
;
Py_BEGIN_ALLOW_THREADS
res
=
mknod
(
filename
,
mode
,
device
);
...
...
@@ -7031,8 +7062,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
PyInt_FromLong
((
long
)
major
(
device
));
}
...
...
@@ -7044,8 +7075,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
PyInt_FromLong
((
long
)
minor
(
device
));
}
...
...
@@ -7060,7 +7091,7 @@ posix_makedev(PyObject *self, PyObject *args)
int
major
,
minor
;
if
(
!
PyArg_ParseTuple
(
args
,
"ii:makedev"
,
&
major
,
&
minor
))
return
NULL
;
return
PyInt_FromLong
((
long
)
makedev
(
major
,
minor
));
return
_PyInt_FromDev
(
makedev
(
major
,
minor
));
}
#endif
/* device macros */
...
...
@@ -8522,7 +8553,6 @@ setup_confname_table(struct constdef *table, size_t tablesize,
{
PyObject
*
d
=
NULL
;
size_t
i
;
qsort
(
table
,
tablesize
,
sizeof
(
struct
constdef
),
cmp_constdefs
);
d
=
PyDict_New
();
if
(
d
==
NULL
)
...
...
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