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
3c85fe07
Kaydet (Commit)
3c85fe07
authored
Kas 04, 2011
tarafından
Petri Lehtinen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #3067: Fix the error raised by locale.setlocale()
üst
12b66b52
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
7 deletions
+23
-7
locale.py
Lib/locale.py
+11
-7
test_locale.py
Lib/test/test_locale.py
+8
-0
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/locale.py
Dosyayı görüntüle @
3c85fe07
...
...
@@ -440,13 +440,17 @@ def _build_localename(localetuple):
No aliasing or normalizing takes place.
"""
language
,
encoding
=
localetuple
if
language
is
None
:
language
=
'C'
if
encoding
is
None
:
return
language
else
:
return
language
+
'.'
+
encoding
try
:
language
,
encoding
=
localetuple
if
language
is
None
:
language
=
'C'
if
encoding
is
None
:
return
language
else
:
return
language
+
'.'
+
encoding
except
(
TypeError
,
ValueError
):
raise
TypeError
(
'Locale must be None, a string, or an iterable of two strings -- language code, encoding.'
)
def
getdefaultlocale
(
envvars
=
(
'LC_ALL'
,
'LC_CTYPE'
,
'LANG'
,
'LANGUAGE'
)):
...
...
Lib/test/test_locale.py
Dosyayı görüntüle @
3c85fe07
...
...
@@ -407,6 +407,14 @@ class TestMiscellaneous(unittest.TestCase):
locale
.
setlocale
(
locale
.
LC_CTYPE
,
loc
)
self
.
assertEqual
(
loc
,
locale
.
getlocale
(
locale
.
LC_CTYPE
))
def
test_invalid_locale_format_in_localetuple
(
self
):
with
self
.
assertRaises
(
TypeError
):
locale
.
setlocale
(
locale
.
LC_ALL
,
b
'fi_FI'
)
def
test_invalid_iterable_in_localetuple
(
self
):
with
self
.
assertRaises
(
TypeError
):
locale
.
setlocale
(
locale
.
LC_ALL
,
(
b
'not'
,
b
'valid'
))
def
test_main
():
tests
=
[
...
...
Misc/ACKS
Dosyayı görüntüle @
3c85fe07
...
...
@@ -717,6 +717,7 @@ John Popplewell
Amrit Prem
Paul Prescod
Donovan Preston
Jyrki Pulliainen
Steve Purcell
Fernando Pérez
Eduardo Pérez
...
...
Misc/NEWS
Dosyayı görüntüle @
3c85fe07
...
...
@@ -66,6 +66,9 @@ Core and Builtins
Library
-------
- Issue #3067: locale.setlocale() now raises TypeError if the second
argument is an invalid iterable. Initial patch by Jyrki Pulliainen.
- Issue #13140: Fix the daemon_threads attribute of ThreadingMixIn.
- Issue #13339: Fix compile error in posixmodule.c due to missing semicolon.
...
...
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