Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
9aa16d93
Kaydet (Commit)
9aa16d93
authored
Nis 20, 2015
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #23842: os.major(), os.minor() and os.makedev() now support ints again.
üst
3ce7873f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
3 deletions
+64
-3
test_posix.py
Lib/test/test_posix.py
+34
-0
NEWS
Misc/NEWS
+2
-0
posixmodule.c
Modules/posixmodule.c
+28
-3
No files found.
Lib/test/test_posix.py
Dosyayı görüntüle @
9aa16d93
...
...
@@ -261,6 +261,40 @@ class PosixTester(unittest.TestCase):
def
test_stat
(
self
):
self
.
assertTrue
(
posix
.
stat
(
test_support
.
TESTFN
))
@unittest.skipUnless
(
hasattr
(
posix
,
'stat'
),
'test needs posix.stat()'
)
@unittest.skipUnless
(
hasattr
(
posix
,
'makedev'
),
'test needs posix.makedev()'
)
def
test_makedev
(
self
):
st
=
posix
.
stat
(
test_support
.
TESTFN
)
dev
=
st
.
st_dev
self
.
assertIsInstance
(
dev
,
(
int
,
long
))
self
.
assertGreaterEqual
(
dev
,
0
)
major
=
posix
.
major
(
dev
)
self
.
assertIsInstance
(
major
,
(
int
,
long
))
self
.
assertGreaterEqual
(
major
,
0
)
self
.
assertEqual
(
posix
.
major
(
int
(
dev
)),
major
)
self
.
assertEqual
(
posix
.
major
(
long
(
dev
)),
major
)
self
.
assertRaises
(
TypeError
,
posix
.
major
,
float
(
dev
))
self
.
assertRaises
(
TypeError
,
posix
.
major
)
self
.
assertRaises
((
ValueError
,
OverflowError
),
posix
.
major
,
-
1
)
minor
=
posix
.
minor
(
dev
)
self
.
assertIsInstance
(
minor
,
(
int
,
long
))
self
.
assertGreaterEqual
(
minor
,
0
)
self
.
assertEqual
(
posix
.
minor
(
int
(
dev
)),
minor
)
self
.
assertEqual
(
posix
.
minor
(
long
(
dev
)),
minor
)
self
.
assertRaises
(
TypeError
,
posix
.
minor
,
float
(
dev
))
self
.
assertRaises
(
TypeError
,
posix
.
minor
)
self
.
assertRaises
((
ValueError
,
OverflowError
),
posix
.
minor
,
-
1
)
self
.
assertEqual
(
posix
.
makedev
(
major
,
minor
),
dev
)
self
.
assertEqual
(
posix
.
makedev
(
int
(
major
),
int
(
minor
)),
dev
)
self
.
assertEqual
(
posix
.
makedev
(
long
(
major
),
long
(
minor
)),
dev
)
self
.
assertRaises
(
TypeError
,
posix
.
makedev
,
float
(
major
),
minor
)
self
.
assertRaises
(
TypeError
,
posix
.
makedev
,
major
,
float
(
minor
))
self
.
assertRaises
(
TypeError
,
posix
.
makedev
,
major
)
self
.
assertRaises
(
TypeError
,
posix
.
makedev
)
def
_test_all_chown_common
(
self
,
chown_func
,
first_param
,
stat_func
):
"""Common code for chown, fchown and lchown tests."""
def
check_stat
(
uid
,
gid
):
...
...
Misc/NEWS
Dosyayı görüntüle @
9aa16d93
...
...
@@ -21,6 +21,8 @@ Core and Builtins
Library
-------
- Issue #23842: os.major(), os.minor() and os.makedev() now support ints again.
- Issue #23811: Add missing newline to the PyCompileError error message.
Patch by Alex Shkop.
...
...
Modules/posixmodule.c
Dosyayı görüntüle @
9aa16d93
...
...
@@ -478,13 +478,38 @@ OverflowUp:
static
int
_Py_Dev_Converter
(
PyObject
*
obj
,
void
*
p
)
{
PyObject
*
index
=
PyNumber_Index
(
obj
);
if
(
index
==
NULL
)
return
0
;
if
(
PyInt_Check
(
index
))
{
long
x
=
PyInt_AS_LONG
(
index
);
Py_DECREF
(
index
);
if
(
x
==
-
1
&&
PyErr_Occurred
())
return
0
;
if
(
x
<
0
)
{
PyErr_SetString
(
PyExc_OverflowError
,
"can't convert negative number to unsigned long"
);
return
0
;
}
*
((
dev_t
*
)
p
)
=
(
unsigned
long
)
x
;
}
else
if
(
PyLong_Check
(
index
))
{
#ifdef HAVE_LONG_LONG
*
((
dev_t
*
)
p
)
=
PyLong_AsUnsignedLongLong
(
obj
);
*
((
dev_t
*
)
p
)
=
PyLong_AsUnsignedLongLong
(
index
);
#else
*
((
dev_t
*
)
p
)
=
PyLong_AsUnsignedLong
(
obj
);
*
((
dev_t
*
)
p
)
=
PyLong_AsUnsignedLong
(
index
);
#endif
if
(
PyErr_Occurred
())
Py_DECREF
(
index
);
if
(
PyErr_Occurred
())
return
0
;
}
else
{
Py_DECREF
(
index
);
PyErr_Format
(
PyExc_TypeError
,
"expected int/long, %s found"
,
Py_TYPE
(
obj
)
->
tp_name
);
return
0
;
}
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