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
f076953e
Kaydet (Commit)
f076953e
authored
Agu 13, 2004
tarafından
Neal Norwitz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
SF patch #1005778, Fix seg fault if list object is modified during list.index()
Backport candidate
üst
39689c5c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
3 deletions
+17
-3
list_tests.py
Lib/test/list_tests.py
+12
-0
NEWS
Misc/NEWS
+4
-0
listobject.c
Objects/listobject.c
+1
-3
No files found.
Lib/test/list_tests.py
Dosyayı görüntüle @
f076953e
...
...
@@ -311,6 +311,18 @@ class CommonTest(seq_tests.CommonTest):
self
.
assertRaises
(
ValueError
,
a
.
index
,
2
,
0
,
4
)
self
.
assertEqual
(
a
,
self
.
type2test
([
-
2
,
-
1
,
0
,
1
,
2
]))
# Test modifying the list during index's iteration
class
EvilCmp
:
def
__init__
(
self
,
victim
):
self
.
victim
=
victim
def
__eq__
(
self
,
other
):
del
self
.
victim
[:]
return
False
a
=
self
.
type2test
()
a
[:]
=
[
EvilCmp
(
a
)
for
_
in
xrange
(
100
)]
# This used to seg fault before patch #1005778
self
.
assertRaises
(
ValueError
,
a
.
index
,
None
)
def
test_reverse
(
self
):
u
=
self
.
type2test
([
-
2
,
-
1
,
0
,
1
,
2
])
u2
=
u
[:]
...
...
Misc/NEWS
Dosyayı görüntüle @
f076953e
...
...
@@ -12,6 +12,10 @@ What's New in Python 2.4 alpha 3?
Core and builtins
-----------------
- SF patch #1005778. Fix a seg fault if the list size changed while
calling list.index(). This could happen if a rich comparison function
modified the list.
- The ``func_name`` (a.k.a. ``__name__``) attribute of user-defined
functions is now writable.
...
...
Objects/listobject.c
Dosyayı görüntüle @
f076953e
...
...
@@ -2186,9 +2186,7 @@ listindex(PyListObject *self, PyObject *args)
if
(
stop
<
0
)
stop
=
0
;
}
else
if
(
stop
>
self
->
ob_size
)
stop
=
self
->
ob_size
;
for
(
i
=
start
;
i
<
stop
;
i
++
)
{
for
(
i
=
start
;
i
<
stop
&&
i
<
self
->
ob_size
;
i
++
)
{
int
cmp
=
PyObject_RichCompareBool
(
self
->
ob_item
[
i
],
v
,
Py_EQ
);
if
(
cmp
>
0
)
return
PyInt_FromLong
((
long
)
i
);
...
...
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