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
d728871e
Kaydet (Commit)
d728871e
authored
Ara 01, 2009
tarafından
Amaury Forgeot d'Arc
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#7419: Fix a crash on Windows in locale.setlocale() when the category
is outside the allowed range.
üst
7072f74d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
1 deletion
+23
-1
test_locale.py
Lib/test/test_locale.py
+11
-0
NEWS
Misc/NEWS
+4
-1
_localemodule.c
Modules/_localemodule.c
+8
-0
No files found.
Lib/test/test_locale.py
Dosyayı görüntüle @
d728871e
...
@@ -360,6 +360,17 @@ class TestMiscellaneous(unittest.TestCase):
...
@@ -360,6 +360,17 @@ class TestMiscellaneous(unittest.TestCase):
# test crasher from bug #3303
# test crasher from bug #3303
self
.
assertRaises
(
TypeError
,
locale
.
strcoll
,
u"a"
,
None
)
self
.
assertRaises
(
TypeError
,
locale
.
strcoll
,
u"a"
,
None
)
def
test_setlocale_category
(
self
):
locale
.
setlocale
(
locale
.
LC_ALL
)
locale
.
setlocale
(
locale
.
LC_TIME
)
locale
.
setlocale
(
locale
.
LC_CTYPE
)
locale
.
setlocale
(
locale
.
LC_COLLATE
)
locale
.
setlocale
(
locale
.
LC_MONETARY
)
locale
.
setlocale
(
locale
.
LC_NUMERIC
)
# crasher from bug #7419
self
.
assertRaises
(
locale
.
Error
,
locale
.
setlocale
,
12345
)
def
test_main
():
def
test_main
():
tests
=
[
tests
=
[
...
...
Misc/NEWS
Dosyayı görüntüle @
d728871e
...
@@ -12,10 +12,13 @@ What's New in Python 2.7 alpha 1
...
@@ -12,10 +12,13 @@ What's New in Python 2.7 alpha 1
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #7419: setlocale() could crash the interpreter on Windows when called
with invalid values.
- Issue #3382: 'F' formatting for float and complex now convert the
- Issue #3382: 'F' formatting for float and complex now convert the
result to upper case. This only affects 'inf' and 'nan', since 'f'
result to upper case. This only affects 'inf' and 'nan', since 'f'
no longer converts to 'g' for large values.
no longer converts to 'g' for large values.
- Remove switch from "%f" formatting to "%g" formatting for floats
- Remove switch from "%f" formatting to "%g" formatting for floats
larger than 1e50 in absolute value.
larger than 1e50 in absolute value.
...
...
Modules/_localemodule.c
Dosyayı görüntüle @
d728871e
...
@@ -163,6 +163,14 @@ PyLocale_setlocale(PyObject* self, PyObject* args)
...
@@ -163,6 +163,14 @@ PyLocale_setlocale(PyObject* self, PyObject* args)
if
(
!
PyArg_ParseTuple
(
args
,
"i|z:setlocale"
,
&
category
,
&
locale
))
if
(
!
PyArg_ParseTuple
(
args
,
"i|z:setlocale"
,
&
category
,
&
locale
))
return
NULL
;
return
NULL
;
#if defined(MS_WINDOWS)
if
(
category
<
LC_MIN
||
category
>
LC_MAX
)
{
PyErr_SetString
(
Error
,
"invalid locale category"
);
return
NULL
;
}
#endif
if
(
locale
)
{
if
(
locale
)
{
/* set locale */
/* set locale */
result
=
setlocale
(
category
,
locale
);
result
=
setlocale
(
category
,
locale
);
...
...
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