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
418f81d9
Kaydet (Commit)
418f81d9
authored
Eyl 24, 2009
tarafından
Mark Dickinson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #1766304: The range.__contains__ optimization should only be
applied to ints, not to instances of subclasses of int.
üst
067b38ee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
test_range.py
Lib/test/test_range.py
+6
-0
rangeobject.c
Objects/rangeobject.c
+1
-1
No files found.
Lib/test/test_range.py
Dosyayı görüntüle @
418f81d9
...
...
@@ -97,6 +97,12 @@ class RangeTest(unittest.TestCase):
# ..except if explicitly told so.
self
.
assertTrue
(
int
(
C2
())
in
range
(
3
))
# Check that the range.__contains__ optimization is only
# used for ints, not for instances of subclasses of int.
class
C3
(
int
):
def
__eq__
(
self
,
other
):
return
True
self
.
assertTrue
(
C3
(
11
)
in
range
(
10
))
self
.
assertTrue
(
C3
(
11
)
in
list
(
range
(
10
)))
def
test_strided_limits
(
self
):
r
=
range
(
0
,
101
,
2
)
...
...
Objects/rangeobject.c
Dosyayı görüntüle @
418f81d9
...
...
@@ -275,7 +275,7 @@ range_reduce(rangeobject *r, PyObject *args)
static
int
range_contains
(
rangeobject
*
r
,
PyObject
*
ob
)
{
if
(
PyLong_Check
(
ob
))
{
if
(
PyLong_Check
Exact
(
ob
)
||
PyBool_Check
(
ob
))
{
int
cmp1
,
cmp2
,
cmp3
;
PyObject
*
tmp1
=
NULL
;
PyObject
*
tmp2
=
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