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
055a3fbe
Kaydet (Commit)
055a3fbe
authored
Nis 03, 2010
tarafından
Mark Dickinson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Internal refactoring in struct.pack: make all integer conversions go through get_pylong.
üst
b9f751ad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
_struct.c
Modules/_struct.c
+20
-20
No files found.
Modules/_struct.c
Dosyayı görüntüle @
055a3fbe
...
@@ -89,7 +89,8 @@ typedef struct { char c; _Bool x; } s_bool;
...
@@ -89,7 +89,8 @@ typedef struct { char c; _Bool x; } s_bool;
#pragma options align=reset
#pragma options align=reset
#endif
#endif
/* Helper to get a PyLongObject. Caller should decref. */
/* Helper for integer format codes: converts an arbitrary Python object to a
PyLongObject if possible, otherwise fails. Caller should decref. */
static
PyObject
*
static
PyObject
*
get_pylong
(
PyObject
*
v
)
get_pylong
(
PyObject
*
v
)
...
@@ -113,13 +114,13 @@ get_long(PyObject *v, long *p)
...
@@ -113,13 +114,13 @@ get_long(PyObject *v, long *p)
{
{
long
x
;
long
x
;
if
(
!
PyLong_Check
(
v
))
{
v
=
get_pylong
(
v
);
PyErr_SetString
(
StructError
,
if
(
v
==
NULL
)
"required argument is not an integer"
);
return
-
1
;
return
-
1
;
}
assert
(
PyLong_Check
(
v
));
x
=
PyLong_AsLong
(
v
);
x
=
PyLong_AsLong
(
v
);
if
(
x
==
-
1
&&
PyErr_Occurred
())
{
Py_DECREF
(
v
);
if
(
x
==
(
long
)
-
1
&&
PyErr_Occurred
())
{
if
(
PyErr_ExceptionMatches
(
PyExc_OverflowError
))
if
(
PyErr_ExceptionMatches
(
PyExc_OverflowError
))
PyErr_SetString
(
StructError
,
PyErr_SetString
(
StructError
,
"argument out of range"
);
"argument out of range"
);
...
@@ -137,11 +138,10 @@ get_ulong(PyObject *v, unsigned long *p)
...
@@ -137,11 +138,10 @@ get_ulong(PyObject *v, unsigned long *p)
{
{
unsigned
long
x
;
unsigned
long
x
;
if
(
!
PyLong_Check
(
v
))
{
v
=
get_pylong
(
v
);
PyErr_SetString
(
StructError
,
if
(
v
==
NULL
)
"required argument is not an integer"
);
return
-
1
;
return
-
1
;
}
assert
(
PyLong_Check
(
v
));
x
=
PyLong_AsUnsignedLong
(
v
);
x
=
PyLong_AsUnsignedLong
(
v
);
if
(
x
==
(
unsigned
long
)
-
1
&&
PyErr_Occurred
())
{
if
(
x
==
(
unsigned
long
)
-
1
&&
PyErr_Occurred
())
{
if
(
PyErr_ExceptionMatches
(
PyExc_OverflowError
))
if
(
PyErr_ExceptionMatches
(
PyExc_OverflowError
))
...
@@ -161,13 +161,13 @@ static int
...
@@ -161,13 +161,13 @@ static int
get_longlong
(
PyObject
*
v
,
PY_LONG_LONG
*
p
)
get_longlong
(
PyObject
*
v
,
PY_LONG_LONG
*
p
)
{
{
PY_LONG_LONG
x
;
PY_LONG_LONG
x
;
if
(
!
PyLong_Check
(
v
))
{
PyErr_SetString
(
StructError
,
v
=
get_pylong
(
v
);
"required argument is not an integer"
);
if
(
v
==
NULL
)
return
-
1
;
return
-
1
;
}
assert
(
PyLong_Check
(
v
));
x
=
PyLong_AsLongLong
(
v
);
x
=
PyLong_AsLongLong
(
v
);
if
(
x
==
-
1
&&
PyErr_Occurred
())
{
if
(
x
==
(
PY_LONG_LONG
)
-
1
&&
PyErr_Occurred
())
{
if
(
PyErr_ExceptionMatches
(
PyExc_OverflowError
))
if
(
PyErr_ExceptionMatches
(
PyExc_OverflowError
))
PyErr_SetString
(
StructError
,
PyErr_SetString
(
StructError
,
"argument out of range"
);
"argument out of range"
);
...
@@ -183,13 +183,13 @@ static int
...
@@ -183,13 +183,13 @@ static int
get_ulonglong
(
PyObject
*
v
,
unsigned
PY_LONG_LONG
*
p
)
get_ulonglong
(
PyObject
*
v
,
unsigned
PY_LONG_LONG
*
p
)
{
{
unsigned
PY_LONG_LONG
x
;
unsigned
PY_LONG_LONG
x
;
if
(
!
PyLong_Check
(
v
))
{
PyErr_SetString
(
StructError
,
v
=
get_pylong
(
v
);
"required argument is not an integer"
);
if
(
v
==
NULL
)
return
-
1
;
return
-
1
;
}
assert
(
PyLong_Check
(
v
));
x
=
PyLong_AsUnsignedLongLong
(
v
);
x
=
PyLong_AsUnsignedLongLong
(
v
);
if
(
x
==
-
1
&&
PyErr_Occurred
())
{
if
(
x
==
(
unsigned
PY_LONG_LONG
)
-
1
&&
PyErr_Occurred
())
{
if
(
PyErr_ExceptionMatches
(
PyExc_OverflowError
))
if
(
PyErr_ExceptionMatches
(
PyExc_OverflowError
))
PyErr_SetString
(
StructError
,
PyErr_SetString
(
StructError
,
"argument out of range"
);
"argument out of range"
);
...
...
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