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
dde99d26
Kaydet (Commit)
dde99d26
authored
Şub 17, 2006
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Remove size constraints in SLICE opcodes.
üst
5c97c798
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
19 deletions
+14
-19
classobject.c
Objects/classobject.c
+3
-3
ceval.c
Python/ceval.c
+11
-16
No files found.
Objects/classobject.c
Dosyayı görüntüle @
dde99d26
...
...
@@ -1170,7 +1170,7 @@ instance_slice(PyInstanceObject *inst, Py_ssize_t i, Py_ssize_t j)
return
NULL
;
arg
=
Py_BuildValue
(
"(N)"
,
sliceobj_from_intint
(
i
,
j
));
}
else
arg
=
Py_BuildValue
(
"(
ii
)"
,
i
,
j
);
arg
=
Py_BuildValue
(
"(
nn
)"
,
i
,
j
);
if
(
arg
==
NULL
)
{
Py_DECREF
(
func
);
...
...
@@ -1241,7 +1241,7 @@ instance_ass_slice(PyInstanceObject *inst, Py_ssize_t i, Py_ssize_t j, PyObject
arg
=
Py_BuildValue
(
"(N)"
,
sliceobj_from_intint
(
i
,
j
));
}
else
arg
=
Py_BuildValue
(
"(
ii
)"
,
i
,
j
);
arg
=
Py_BuildValue
(
"(
nn
)"
,
i
,
j
);
}
else
{
if
(
setslicestr
==
NULL
)
...
...
@@ -1262,7 +1262,7 @@ instance_ass_slice(PyInstanceObject *inst, Py_ssize_t i, Py_ssize_t j, PyObject
arg
=
Py_BuildValue
(
"(NO)"
,
sliceobj_from_intint
(
i
,
j
),
value
);
}
else
arg
=
Py_BuildValue
(
"(
ii
O)"
,
i
,
j
,
value
);
arg
=
Py_BuildValue
(
"(
nn
O)"
,
i
,
j
,
value
);
}
if
(
arg
==
NULL
)
{
Py_DECREF
(
func
);
...
...
Python/ceval.c
Dosyayı görüntüle @
dde99d26
...
...
@@ -3851,8 +3851,9 @@ ext_do_call(PyObject *func, PyObject ***pp_stack, int flags, int na, int nk)
}
/* Extract a slice index from a PyInt or PyLong, and store in *pi.
Silently reduce values larger than INT_MAX to INT_MAX, and silently
boost values less than -INT_MAX to 0. Return 0 on error, 1 on success.
Silently reduce values larger than PY_SSIZE_T_MAX to PY_SSIZE_T_MAX,
and silently boost values less than -PY_SSIZE_T_MAX to 0.
Return 0 on error, 1 on success.
*/
/* Note: If v is NULL, return success without storing into *pi. This
is because_PyEval_SliceIndex() is called by apply_slice(), which can be
...
...
@@ -3862,11 +3863,11 @@ int
_PyEval_SliceIndex
(
PyObject
*
v
,
Py_ssize_t
*
pi
)
{
if
(
v
!=
NULL
)
{
long
x
;
Py_ssize_t
x
;
if
(
PyInt_Check
(
v
))
{
x
=
PyInt_AsLong
(
v
);
}
else
if
(
PyLong_Check
(
v
))
{
x
=
Py
Long_AsLong
(
v
);
x
=
Py
Int_AsSsize_t
(
v
);
if
(
x
==-
1
&&
PyErr_Occurred
())
{
PyObject
*
long_zero
;
int
cmp
;
...
...
@@ -3883,8 +3884,8 @@ _PyEval_SliceIndex(PyObject *v, Py_ssize_t *pi)
/* It's an overflow error, so we need to
check the sign of the long integer,
set the value to
INT_MAX or -INT_MAX,
and clear the error. */
set the value to
PY_SSIZE_T_MAX or
-PY_SSIZE_T_MAX,
and clear the error. */
/* Create a long integer with a value of 0 */
long_zero
=
PyLong_FromLong
(
0L
);
...
...
@@ -3898,21 +3899,15 @@ _PyEval_SliceIndex(PyObject *v, Py_ssize_t *pi)
if
(
cmp
<
0
)
return
0
;
else
if
(
cmp
)
x
=
IN
T_MAX
;
x
=
PY_SSIZE_
T_MAX
;
else
x
=
-
IN
T_MAX
;
x
=
-
PY_SSIZE_
T_MAX
;
}
}
else
{
PyErr_SetString
(
PyExc_TypeError
,
"slice indices must be integers"
);
return
0
;
}
/* Truncate -- very long indices are truncated anyway */
/* XXX truncate by ssize maximum */
if
(
x
>
INT_MAX
)
x
=
INT_MAX
;
else
if
(
x
<
-
INT_MAX
)
x
=
-
INT_MAX
;
*
pi
=
x
;
}
return
1
;
...
...
@@ -3928,7 +3923,7 @@ apply_slice(PyObject *u, PyObject *v, PyObject *w) /* return u[v:w] */
PySequenceMethods
*
sq
=
tp
->
tp_as_sequence
;
if
(
sq
&&
sq
->
sq_slice
&&
ISINT
(
v
)
&&
ISINT
(
w
))
{
Py_ssize_t
ilow
=
0
,
ihigh
=
IN
T_MAX
;
Py_ssize_t
ilow
=
0
,
ihigh
=
PY_SSIZE_
T_MAX
;
if
(
!
_PyEval_SliceIndex
(
v
,
&
ilow
))
return
NULL
;
if
(
!
_PyEval_SliceIndex
(
w
,
&
ihigh
))
...
...
@@ -3955,7 +3950,7 @@ assign_slice(PyObject *u, PyObject *v, PyObject *w, PyObject *x)
PySequenceMethods
*
sq
=
tp
->
tp_as_sequence
;
if
(
sq
&&
sq
->
sq_slice
&&
ISINT
(
v
)
&&
ISINT
(
w
))
{
Py_ssize_t
ilow
=
0
,
ihigh
=
IN
T_MAX
;
Py_ssize_t
ilow
=
0
,
ihigh
=
PY_SSIZE_
T_MAX
;
if
(
!
_PyEval_SliceIndex
(
v
,
&
ilow
))
return
-
1
;
if
(
!
_PyEval_SliceIndex
(
w
,
&
ihigh
))
...
...
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