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
b46ad543
Unverified
Kaydet (Commit)
b46ad543
authored
Eyl 21, 2018
tarafından
Raymond Hettinger
Kaydeden (comit)
GitHub
Eyl 21, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Minor performance tweak for deque.index() with a start argument (GH-9440)
üst
fb3e9c00
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
test_deque.py
Lib/test/test_deque.py
+8
-0
_collectionsmodule.c
Modules/_collectionsmodule.c
+4
-2
No files found.
Lib/test/test_deque.py
Dosyayı görüntüle @
b46ad543
...
...
@@ -288,6 +288,14 @@ class TestBasic(unittest.TestCase):
else
:
self
.
assertEqual
(
d
.
index
(
element
,
start
,
stop
),
target
)
# Test large start argument
d
=
deque
(
range
(
0
,
10000
,
10
))
for
step
in
range
(
100
):
i
=
d
.
index
(
8500
,
700
)
self
.
assertEqual
(
d
[
i
],
8500
)
# Repeat test with a different internal offset
d
.
rotate
()
def
test_index_bug_24913
(
self
):
d
=
deque
(
'A'
*
3
)
with
self
.
assertRaises
(
ValueError
):
...
...
Modules/_collectionsmodule.c
Dosyayı görüntüle @
b46ad543
...
...
@@ -1050,8 +1050,10 @@ deque_index(dequeobject *deque, PyObject *const *args, Py_ssize_t nargs)
start
=
stop
;
assert
(
0
<=
start
&&
start
<=
stop
&&
stop
<=
Py_SIZE
(
deque
));
/* XXX Replace this loop with faster code from deque_item() */
for
(
i
=
0
;
i
<
start
;
i
++
)
{
for
(
i
=
0
;
i
<
start
-
BLOCKLEN
;
i
+=
BLOCKLEN
)
{
b
=
b
->
rightlink
;
}
for
(
;
i
<
start
;
i
++
)
{
index
++
;
if
(
index
==
BLOCKLEN
)
{
b
=
b
->
rightlink
;
...
...
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