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
f5b93736
Kaydet (Commit)
f5b93736
authored
Eyl 04, 2003
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Patch #798145: Return correct information from nl_langinfo(RADIXCHAR).
Will backport to 2.3.
üst
6bc06eca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
0 deletions
+46
-0
test__locale.py
Lib/test/test__locale.py
+34
-0
_localemodule.c
Modules/_localemodule.c
+12
-0
No files found.
Lib/test/test__locale.py
0 → 100644
Dosyayı görüntüle @
f5b93736
from
test.test_support
import
verbose
,
TestSkipped
from
_locale
import
setlocale
,
LC_NUMERIC
,
RADIXCHAR
,
THOUSEP
,
nl_langinfo
from
_locale
import
localeconv
,
Error
candidate_locales
=
[
'es_UY'
,
'fr_FR'
,
'fi_FI'
,
'es_CO'
,
'pt_PT'
,
'it_IT'
,
'et_EE'
,
'es_PY'
,
'no_NO'
,
'nl_NL'
,
'lv_LV'
,
'el_GR'
,
'be_BY'
,
'fr_BE'
,
'ro_RO'
,
'ru_UA'
,
'ru_RU'
,
'es_VE'
,
'ca_ES'
,
'se_NO'
,
'es_EC'
,
'id_ID'
,
'ka_GE'
,
'es_CL'
,
'hu_HU'
,
'wa_BE'
,
'lt_LT'
,
'sl_SI'
,
'hr_HR'
,
'es_AR'
,
'es_ES'
,
'oc_FR'
,
'gl_ES'
,
'bg_BG'
,
'is_IS'
,
'mk_MK'
,
'de_AT'
,
'pt_BR'
,
'da_DK'
,
'nn_NO'
,
'cs_CZ'
,
'de_LU'
,
'es_BO'
,
'sq_AL'
,
'sk_SK'
,
'fr_CH'
,
'de_DE'
,
'sr_YU'
,
'br_FR'
,
'nl_BE'
,
'sv_FI'
,
'pl_PL'
,
'fr_CA'
,
'fo_FO'
,
'bs_BA'
,
'fr_LU'
,
'kl_GL'
,
'fa_IR'
,
'de_BE'
,
'sv_SE'
,
'it_CH'
,
'uk_UA'
,
'eu_ES'
,
'vi_VN'
,
'af_ZA'
,
'nb_NO'
,
'en_DK'
,
'tg_TJ'
]
saw_locale
=
0
for
loc
in
candidate_locales
:
try
:
setlocale
(
LC_NUMERIC
,
loc
)
except
Error
:
continue
if
verbose
:
print
"locale
%
r"
%
loc
saw_locale
=
1
nl_radixchar
=
nl_langinfo
(
RADIXCHAR
)
li_radixchar
=
localeconv
()[
'decimal_point'
]
if
nl_radixchar
!=
li_radixchar
:
print
"
%
r !=
%
r"
%
(
nl_radixchar
,
li_radixchar
)
nl_radixchar
=
nl_langinfo
(
THOUSEP
)
li_radixchar
=
localeconv
()[
'thousands_sep'
]
if
nl_radixchar
!=
li_radixchar
:
print
"
%
r !=
%
r"
%
(
nl_radixchar
,
li_radixchar
)
if
not
saw_locale
:
raise
ImportError
,
"None of the listed locales found"
Modules/_localemodule.c
Dosyayı görüntüle @
f5b93736
...
@@ -579,6 +579,18 @@ PyLocale_nl_langinfo(PyObject* self, PyObject* args)
...
@@ -579,6 +579,18 @@ PyLocale_nl_langinfo(PyObject* self, PyObject* args)
/* Check whether this is a supported constant. GNU libc sometimes
/* Check whether this is a supported constant. GNU libc sometimes
returns numeric values in the char* return value, which would
returns numeric values in the char* return value, which would
crash PyString_FromString. */
crash PyString_FromString. */
#ifdef RADIXCHAR
if
(
saved_numeric
)
{
if
(
item
==
RADIXCHAR
)
{
Py_INCREF
(
decimal_point
);
return
decimal_point
;
}
if
(
item
==
THOUSEP
)
{
Py_INCREF
(
thousands_sep
);
return
thousands_sep
;
}
}
#endif
for
(
i
=
0
;
langinfo_constants
[
i
].
name
;
i
++
)
for
(
i
=
0
;
langinfo_constants
[
i
].
name
;
i
++
)
if
(
langinfo_constants
[
i
].
value
==
item
)
if
(
langinfo_constants
[
i
].
value
==
item
)
return
PyString_FromString
(
nl_langinfo
(
item
));
return
PyString_FromString
(
nl_langinfo
(
item
));
...
...
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