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
b9030f4f
Kaydet (Commit)
b9030f4f
authored
May 12, 2008
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#2196 hasattr now allows SystemExit and KeyboardInterrupt to propagate
üst
42bfa90f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
3 deletions
+20
-3
test_builtin.py
Lib/test/test_builtin.py
+10
-0
NEWS
Misc/NEWS
+3
-0
bltinmodule.c
Python/bltinmodule.c
+7
-3
No files found.
Lib/test/test_builtin.py
Dosyayı görüntüle @
b9030f4f
...
...
@@ -590,6 +590,16 @@ class BuiltinTest(unittest.TestCase):
if
have_unicode
:
self
.
assertRaises
(
UnicodeError
,
hasattr
,
sys
,
unichr
(
sys
.
maxunicode
))
# Check that hasattr allows SystemExit and KeyboardInterrupts by
class
A
:
def
__getattr__
(
self
,
what
):
raise
KeyboardInterrupt
self
.
assertRaises
(
KeyboardInterrupt
,
hasattr
,
A
(),
"b"
)
class
B
:
def
__getattr__
(
self
,
what
):
raise
SystemExit
self
.
assertRaises
(
SystemExit
,
hasattr
,
B
(),
"b"
)
def
test_hash
(
self
):
hash
(
None
)
self
.
assertEqual
(
hash
(
1
),
hash
(
1L
))
...
...
Misc/NEWS
Dosyayı görüntüle @
b9030f4f
...
...
@@ -17,6 +17,9 @@ Core and Builtins
- Issue #2790: sys.flags was not properly exposing its bytes_warning attribute.
- Issue #2196: hasattr now lets exceptions which do not inherit Exception
(KeyboardInterrupt, and SystemExit) propagate instead of ignoring them
Extension Modules
-----------------
...
...
Python/bltinmodule.c
Dosyayı görüntüle @
b9030f4f
...
...
@@ -877,9 +877,13 @@ builtin_hasattr(PyObject *self, PyObject *args)
}
v
=
PyObject_GetAttr
(
v
,
name
);
if
(
v
==
NULL
)
{
PyErr_Clear
();
Py_INCREF
(
Py_False
);
return
Py_False
;
if
(
!
PyErr_ExceptionMatches
(
PyExc_Exception
))
return
NULL
;
else
{
PyErr_Clear
();
Py_INCREF
(
Py_False
);
return
Py_False
;
}
}
Py_DECREF
(
v
);
Py_INCREF
(
Py_True
);
...
...
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