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
0bd1a2dc
Kaydet (Commit)
0bd1a2dc
authored
Eyl 12, 2018
tarafından
Oren Milman
Kaydeden (comit)
Serhiy Storchaka
Eyl 12, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-31577: Fix a crash in os.utime() in case of a bad ns argument. (GH-3752)
üst
e5024517
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
0 deletions
+24
-0
test_os.py
Lib/test/test_os.py
+16
-0
2017-09-25-20-36-24.bpo-31577.jgYsSA.rst
...ore and Builtins/2017-09-25-20-36-24.bpo-31577.jgYsSA.rst
+2
-0
posixmodule.c
Modules/posixmodule.c
+6
-0
No files found.
Lib/test/test_os.py
Dosyayı görüntüle @
0bd1a2dc
...
...
@@ -635,6 +635,22 @@ class UtimeTests(unittest.TestCase):
with
self
.
assertRaises
(
ValueError
):
os
.
utime
(
self
.
fname
,
(
5
,
5
),
ns
=
(
5
,
5
))
@support.cpython_only
def
test_issue31577
(
self
):
# The interpreter shouldn't crash in case utime() received a bad
# ns argument.
def
get_bad_int
(
divmod_ret_val
):
class
BadInt
:
def
__divmod__
(
*
args
):
return
divmod_ret_val
return
BadInt
()
with
self
.
assertRaises
(
TypeError
):
os
.
utime
(
self
.
fname
,
ns
=
(
get_bad_int
(
42
),
1
))
with
self
.
assertRaises
(
TypeError
):
os
.
utime
(
self
.
fname
,
ns
=
(
get_bad_int
(()),
1
))
with
self
.
assertRaises
(
TypeError
):
os
.
utime
(
self
.
fname
,
ns
=
(
get_bad_int
((
1
,
2
,
3
)),
1
))
from
test
import
mapping_tests
...
...
Misc/NEWS.d/next/Core and Builtins/2017-09-25-20-36-24.bpo-31577.jgYsSA.rst
0 → 100644
Dosyayı görüntüle @
0bd1a2dc
Fix a crash in `os.utime()` in case of a bad ns argument. Patch by Oren
Milman.
Modules/posixmodule.c
Dosyayı görüntüle @
0bd1a2dc
...
...
@@ -4630,6 +4630,12 @@ split_py_long_to_s_and_ns(PyObject *py_long, time_t *s, long *ns)
divmod = PyNumber_Divmod(py_long, billion);
if (!divmod)
goto exit;
if (!PyTuple_Check(divmod) || PyTuple_GET_SIZE(divmod) != 2) {
PyErr_Format(PyExc_TypeError,
"%.200s.__divmod__() must return a 2-tuple, not %.200s",
Py_TYPE(py_long)->tp_name, Py_TYPE(divmod)->tp_name);
goto exit;
}
*s = _PyLong_AsTime_t(PyTuple_GET_ITEM(divmod, 0));
if ((*s == -1) && PyErr_Occurred())
goto exit;
...
...
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