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
2a7dedef
Kaydet (Commit)
2a7dedef
authored
Agu 07, 2004
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
SF bug #1004669: Type returned from .keys() is not checked
üst
61992efc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
test_builtin.py
Lib/test/test_builtin.py
+9
-0
object.c
Objects/object.c
+5
-0
No files found.
Lib/test/test_builtin.py
Dosyayı görüntüle @
2a7dedef
...
...
@@ -322,6 +322,15 @@ class BuiltinTest(unittest.TestCase):
ss
[
'a3'
]
=
'a2*7'
self
.
assertEqual
(
ss
[
'a3'
],
210
)
# Verify that dir() catches a non-list returned by eval
# SF bug #1004669
class
C
:
def
__getitem__
(
self
,
item
):
raise
KeyError
(
item
)
def
keys
(
self
):
return
'a'
self
.
assertRaises
(
TypeError
,
eval
,
'dir()'
,
globals
(),
C
())
# Done outside of the method test_z to get the correct scope
z
=
0
f
=
open
(
TESTFN
,
'w'
)
...
...
Objects/object.c
Dosyayı görüntüle @
2a7dedef
...
...
@@ -1702,6 +1702,11 @@ PyObject_Dir(PyObject *arg)
}
assert
(
result
);
if
(
!
PyList_Check
(
result
))
{
PyErr_SetString
(
PyExc_TypeError
,
"Expected keys() to be a list."
);
goto
error
;
}
if
(
PyList_Sort
(
result
)
!=
0
)
goto
error
;
else
...
...
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