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
7f59b5cc
Kaydet (Commit)
7f59b5cc
authored
Tem 24, 2008
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Convert from long to Py_ssize_t.
üst
527eee2b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
enumobject.c
Objects/enumobject.c
+11
-10
No files found.
Objects/enumobject.c
Dosyayı görüntüle @
7f59b5cc
...
...
@@ -4,10 +4,10 @@
typedef
struct
{
PyObject_HEAD
long
en_index
;
/* current index of enumeration */
Py_ssize_t
en_index
;
/* current index of enumeration */
PyObject
*
en_sit
;
/* secondary iterator of enumeration */
PyObject
*
en_result
;
/* result tuple */
PyObject
*
en_longindex
;
/* index for sequences >=
LONG
_MAX */
PyObject
*
en_longindex
;
/* index for sequences >=
PY_SSIZE_T
_MAX */
}
enumobject
;
static
PyObject
*
...
...
@@ -25,18 +25,19 @@ enum_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
en
=
(
enumobject
*
)
type
->
tp_alloc
(
type
,
0
);
if
(
en
==
NULL
)
return
NULL
;
if
(
start
)
{
if
(
start
!=
NULL
)
{
start
=
PyNumber_Index
(
start
);
if
(
start
==
NULL
)
{
Py_DECREF
(
en
);
return
NULL
;
}
if
(
PyLong_Check
(
start
))
{
en
->
en_index
=
LONG_MAX
;
assert
(
PyInt_Check
(
start
)
||
PyLong_Check
(
start
));
en
->
en_index
=
PyInt_AsSsize_t
(
start
);
if
(
en
->
en_index
==
-
1
&&
PyErr_Occurred
())
{
PyErr_Clear
();
en
->
en_index
=
PY_SSIZE_T_MAX
;
en
->
en_longindex
=
start
;
}
else
{
assert
(
PyInt_Check
(
start
));
en
->
en_index
=
PyInt_AsLong
(
start
);
en
->
en_longindex
=
NULL
;
Py_DECREF
(
start
);
}
...
...
@@ -85,7 +86,7 @@ enum_next_long(enumobject *en, PyObject* next_item)
PyObject
*
stepped_up
;
if
(
en
->
en_longindex
==
NULL
)
{
en
->
en_longindex
=
PyInt_From
Long
(
LONG
_MAX
);
en
->
en_longindex
=
PyInt_From
Ssize_t
(
PY_SSIZE_T
_MAX
);
if
(
en
->
en_longindex
==
NULL
)
return
NULL
;
}
...
...
@@ -130,10 +131,10 @@ enum_next(enumobject *en)
if
(
next_item
==
NULL
)
return
NULL
;
if
(
en
->
en_index
==
LONG
_MAX
)
if
(
en
->
en_index
==
PY_SSIZE_T
_MAX
)
return
enum_next_long
(
en
,
next_item
);
next_index
=
PyInt_From
Long
(
en
->
en_index
);
next_index
=
PyInt_From
Ssize_t
(
en
->
en_index
);
if
(
next_index
==
NULL
)
{
Py_DECREF
(
next_item
);
return
NULL
;
...
...
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