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
c992fafd
Kaydet (Commit)
c992fafd
authored
Kas 04, 2012
tarafından
Mark Dickinson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #16402: Merge fix from 3.3
üst
729eda4a
1321edaa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
5 deletions
+17
-5
test_range.py
Lib/test/test_range.py
+9
-0
NEWS
Misc/NEWS
+3
-0
rangeobject.c
Objects/rangeobject.c
+5
-5
No files found.
Lib/test/test_range.py
Dosyayı görüntüle @
c992fafd
...
...
@@ -312,6 +312,15 @@ class RangeTest(unittest.TestCase):
self
.
assertRaises
(
TypeError
,
range
,
IN
())
# Test use of user-defined classes in slice indices.
self
.
assertEqual
(
range
(
10
)[:
I
(
5
)],
range
(
5
))
with
self
.
assertRaises
(
RuntimeError
):
range
(
0
,
10
)[:
IX
()]
with
self
.
assertRaises
(
TypeError
):
range
(
0
,
10
)[:
IN
()]
def
test_count
(
self
):
self
.
assertEqual
(
range
(
3
)
.
count
(
-
1
),
0
)
self
.
assertEqual
(
range
(
3
)
.
count
(
0
),
1
)
...
...
Misc/NEWS
Dosyayı görüntüle @
c992fafd
...
...
@@ -10,6 +10,9 @@ What's New in Python 3.4.0 Alpha 1?
Core and Builtins
-----------------
- Issue #16402: When slicing a range, fix shadowing of exceptions from
__index__.
- Issue #16336: fix input checking in the surrogatepass error handler.
Patch by Serhiy Storchaka.
...
...
Objects/rangeobject.c
Dosyayı görüntüle @
c992fafd
...
...
@@ -331,11 +331,11 @@ compute_slice_element(PyObject *obj)
if
(
PyIndex_Check
(
obj
))
{
result
=
PyNumber_Index
(
obj
);
}
}
if
(
result
==
NULL
)
{
PyErr_SetString
(
PyExc_TypeError
,
"slice indices must be integers or "
"None or have an __index__ method"
);
else
{
PyErr_SetString
(
PyExc_TypeError
,
"slice indices must be integers or "
"None or have an __index__ method"
);
}
}
return
result
;
}
...
...
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