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
c9f38462
Kaydet (Commit)
c9f38462
authored
Kas 04, 2011
tarafından
Petri Lehtinen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #3067: Fix the error raised by locale.setlocale()
üst
e30c0a10
3c85fe07
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 @
c9f38462
...
...
@@ -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 @
c9f38462
...
...
@@ -409,6 +409,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 @
c9f38462
...
...
@@ -768,6 +768,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 @
c9f38462
...
...
@@ -350,6 +350,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