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
01fce5ad
Kaydet (Commit)
01fce5ad
authored
May 03, 2009
tarafından
Mark Dickinson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Don't use PyOS_strnicmp for NaN and Inf detection: it's locale-aware.
üst
777e4ff5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
pystrtod.c
Python/pystrtod.c
+16
-3
No files found.
Python/pystrtod.c
Dosyayı görüntüle @
01fce5ad
...
@@ -40,6 +40,19 @@
...
@@ -40,6 +40,19 @@
correctly rounded results.
correctly rounded results.
*/
*/
/* Case-insensitive string match used for nan and inf detection; t should be
lower-case. Returns 1 for a successful match, 0 otherwise. */
static
int
case_insensitive_match
(
const
char
*
s
,
const
char
*
t
)
{
while
(
*
t
&&
Py_TOLOWER
(
*
s
)
==
*
t
)
{
s
++
;
t
++
;
}
return
*
t
?
0
:
1
;
}
double
double
PyOS_ascii_strtod
(
const
char
*
nptr
,
char
**
endptr
)
PyOS_ascii_strtod
(
const
char
*
nptr
,
char
**
endptr
)
{
{
...
@@ -89,9 +102,9 @@ PyOS_ascii_strtod(const char *nptr, char **endptr)
...
@@ -89,9 +102,9 @@ PyOS_ascii_strtod(const char *nptr, char **endptr)
/* Parse infinities and nans */
/* Parse infinities and nans */
if
(
*
p
==
'i'
||
*
p
==
'I'
)
{
if
(
*
p
==
'i'
||
*
p
==
'I'
)
{
if
(
PyOS_strnicmp
(
p
,
"inf"
,
3
)
==
0
)
{
if
(
case_insensitive_match
(
p
+
1
,
"nf"
)
)
{
val
=
Py_HUGE_VAL
;
val
=
Py_HUGE_VAL
;
if
(
PyOS_strnicmp
(
p
+
3
,
"inity"
,
5
)
==
0
)
if
(
case_insensitive_match
(
p
+
3
,
"inity"
)
)
fail_pos
=
(
char
*
)
p
+
8
;
fail_pos
=
(
char
*
)
p
+
8
;
else
else
fail_pos
=
(
char
*
)
p
+
3
;
fail_pos
=
(
char
*
)
p
+
3
;
...
@@ -102,7 +115,7 @@ PyOS_ascii_strtod(const char *nptr, char **endptr)
...
@@ -102,7 +115,7 @@ PyOS_ascii_strtod(const char *nptr, char **endptr)
}
}
#ifdef Py_NAN
#ifdef Py_NAN
if
(
*
p
==
'n'
||
*
p
==
'N'
)
{
if
(
*
p
==
'n'
||
*
p
==
'N'
)
{
if
(
PyOS_strnicmp
(
p
,
"nan"
,
3
)
==
0
)
{
if
(
case_insensitive_match
(
p
+
1
,
"an"
)
)
{
val
=
Py_NAN
;
val
=
Py_NAN
;
fail_pos
=
(
char
*
)
p
+
3
;
fail_pos
=
(
char
*
)
p
+
3
;
goto
got_val
;
goto
got_val
;
...
...
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