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
610a51f3
Kaydet (Commit)
610a51f3
authored
May 17, 2015
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #23757: Only call the concrete list API for exact lists.
üst
6558190e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletion
+16
-1
seq_tests.py
Lib/test/seq_tests.py
+12
-0
NEWS
Misc/NEWS
+3
-0
abstract.c
Objects/abstract.c
+1
-1
No files found.
Lib/test/seq_tests.py
Dosyayı görüntüle @
610a51f3
...
...
@@ -85,6 +85,14 @@ def itermulti(seqn):
'Test multiple tiers of iterators'
return
chain
(
map
(
lambda
x
:
x
,
iterfunc
(
IterGen
(
Sequence
(
seqn
)))))
class
LyingTuple
(
tuple
):
def
__iter__
(
self
):
yield
1
class
LyingList
(
list
):
def
__iter__
(
self
):
yield
1
class
CommonTest
(
unittest
.
TestCase
):
# The type to be tested
type2test
=
None
...
...
@@ -131,6 +139,10 @@ class CommonTest(unittest.TestCase):
self
.
assertRaises
(
TypeError
,
self
.
type2test
,
IterNoNext
(
s
))
self
.
assertRaises
(
ZeroDivisionError
,
self
.
type2test
,
IterGenExc
(
s
))
# Issue #23757
self
.
assertEqual
(
self
.
type2test
(
LyingTuple
((
2
,))),
self
.
type2test
((
1
,)))
self
.
assertEqual
(
self
.
type2test
(
LyingList
([
2
])),
self
.
type2test
([
1
]))
def
test_truth
(
self
):
self
.
assertFalse
(
self
.
type2test
())
self
.
assertTrue
(
self
.
type2test
([
42
]))
...
...
Misc/NEWS
Dosyayı görüntüle @
610a51f3
...
...
@@ -13,6 +13,9 @@ Core and Builtins
- Issue #20274: Remove ignored and erroneous "kwargs" parameters from three
METH_VARARGS methods on _sqlite.Connection.
- Issue #23757: PySequence_Tuple() incorrectly called the concrete list API
when the data was a list subclass.
- Issue #24096: Make warnings.warn_explicit more robust against mutation of the
warnings.filters list.
...
...
Objects/abstract.c
Dosyayı görüntüle @
610a51f3
...
...
@@ -1636,7 +1636,7 @@ PySequence_Tuple(PyObject *v)
Py_INCREF
(
v
);
return
v
;
}
if
(
PyList_Check
(
v
))
if
(
PyList_Check
Exact
(
v
))
return
PyList_AsTuple
(
v
);
/* Get iterator. */
...
...
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