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
25236216
Kaydet (Commit)
25236216
authored
Agu 22, 2007
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Change the error reporting when an invalid string is encountered to avoid
reporting s'x' as the input (which is a lie).
üst
ae211f9a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
18 deletions
+9
-18
longobject.c
Objects/longobject.c
+9
-18
No files found.
Objects/longobject.c
Dosyayı görüntüle @
25236216
...
...
@@ -1689,7 +1689,7 @@ PyLong_FromString(char *str, char **pend, int base)
int
sign
=
1
,
error_if_nonzero
=
0
;
char
*
start
,
*
orig_str
=
str
;
PyLongObject
*
z
=
NULL
;
PyObject
*
strobj
,
*
strrepr
;
PyObject
*
strobj
;
Py_ssize_t
slen
;
if
((
base
!=
0
&&
base
<
2
)
||
base
>
36
)
{
...
...
@@ -1956,17 +1956,13 @@ digit beyond the first.
onError:
Py_XDECREF
(
z
);
slen
=
strlen
(
orig_str
)
<
200
?
strlen
(
orig_str
)
:
200
;
strobj
=
Py
String
_FromStringAndSize
(
orig_str
,
slen
);
strobj
=
Py
Unicode
_FromStringAndSize
(
orig_str
,
slen
);
if
(
strobj
==
NULL
)
return
NULL
;
strrepr
=
PyObject_ReprStr8
(
strobj
);
Py_DECREF
(
strobj
);
if
(
strrepr
==
NULL
)
return
NULL
;
PyErr_Format
(
PyExc_ValueError
,
"invalid literal for int() with base %d: %
s
"
,
base
,
PyString_AS_STRING
(
strrepr
)
);
Py_DECREF
(
str
repr
);
"invalid literal for int() with base %d: %
R
"
,
base
,
strobj
);
Py_DECREF
(
str
obj
);
return
NULL
;
}
...
...
@@ -3533,16 +3529,11 @@ long_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
size
=
PyString_GET_SIZE
(
x
);
}
if
(
strlen
(
string
)
!=
size
)
{
/* create a repr() of the input string,
* just like PyLong_FromString does. */
PyObject
*
srepr
;
srepr
=
PyObject_ReprStr8
(
x
);
if
(
srepr
==
NULL
)
return
NULL
;
/* We only see this if there's a null byte in x,
x is a str8 or a bytes, *and* a base is given. */
PyErr_Format
(
PyExc_ValueError
,
"invalid literal for int() with base %d: %s"
,
base
,
PyString_AS_STRING
(
srepr
));
Py_DECREF
(
srepr
);
"invalid literal for int() with base %d: %R"
,
base
,
x
);
return
NULL
;
}
return
PyLong_FromString
(
string
,
NULL
,
base
);
...
...
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