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
e78e5d2e
Kaydet (Commit)
e78e5d2e
authored
Tem 17, 2009
tarafından
Hirokazu Yamamoto
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #6415: Fixed warnings.warn sagfault on bad formatted string.
üst
66da2635
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
test_warnings.py
Lib/test/test_warnings.py
+13
-0
_warnings.c
Python/_warnings.c
+2
-0
No files found.
Lib/test/test_warnings.py
Dosyayı görüntüle @
e78e5d2e
...
...
@@ -327,6 +327,19 @@ class WarnTests(unittest.TestCase):
self
.
module
.
warn_explicit
,
None
,
Warning
,
None
,
1
,
registry
=
42
)
def
test_bad_str
(
self
):
# issue 6415
# Warnings instance with a bad format string for __str__ should not
# trigger a bus error.
class
BadStrWarning
(
Warning
):
"""Warning with a bad format string for __str__."""
def
__str__
(
self
):
return
(
"A bad formatted string
%(err)
"
%
{
"err"
:
"there is no
%(err)
s"
})
with
self
.
assertRaises
(
ValueError
):
self
.
module
.
warn
(
BadStrWarning
())
class
CWarnTests
(
BaseTest
,
WarnTests
):
module
=
c_warnings
...
...
Python/_warnings.c
Dosyayı görüntüle @
e78e5d2e
...
...
@@ -317,6 +317,8 @@ warn_explicit(PyObject *category, PyObject *message,
}
if
(
rc
==
1
)
{
text
=
PyObject_Str
(
message
);
if
(
text
==
NULL
)
goto
cleanup
;
category
=
(
PyObject
*
)
message
->
ob_type
;
}
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