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
4d3f084c
Kaydet (Commit)
4d3f084c
authored
Eki 08, 2017
tarafından
Serhiy Storchaka
Kaydeden (comit)
GitHub
Eki 08, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-27867: Add a porting guide for PySlice_GetIndicesEx(). (#1973)
üst
0ccc0f6c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
slice.rst
Doc/c-api/slice.rst
+17
-1
3.7.rst
Doc/whatsnew/3.7.rst
+13
-0
No files found.
Doc/c-api/slice.rst
Dosyayı görüntüle @
4d3f084c
...
...
@@ -53,6 +53,22 @@ Slice Objects
Returns ``0`` on success and ``-1`` on error with exception set.
.. note::
This function is considered not safe for resizable sequences.
Its invocation should be replaced by a combination of
:c:func:`PySlice_Unpack` and :c:func:`PySlice_AdjustIndices` where ::
if (PySlice_GetIndicesEx(slice, length, &start, &stop, &step, &slicelength) < 0) {
// return error
}
is replaced by ::
if (PySlice_Unpack(slice, &start, &stop, &step) < 0) {
// return error
}
slicelength = PySlice_AdjustIndices(length, &start, &stop, step);
.. versionchanged:: 3.2
The parameter type for the *slice* parameter was ``PySliceObject*``
before.
...
...
@@ -61,7 +77,7 @@ Slice Objects
If ``Py_LIMITED_API`` is not set or set to the value between ``0x03050400``
and ``0x03060000`` (not including) or ``0x03060100`` or higher
:c:func:`!PySlice_GetIndicesEx` is implemented as a macro using
:c:func:`
PySlice_Unpack` and :c:func:`
PySlice_AdjustIndices`.
:c:func:`
!PySlice_Unpack` and :c:func:`!
PySlice_AdjustIndices`.
Arguments *start*, *stop* and *step* are evaluated more than once.
.. deprecated:: 3.6.1
...
...
Doc/whatsnew/3.7.rst
Dosyayı görüntüle @
4d3f084c
...
...
@@ -581,6 +581,19 @@ Changes in the Python API
in the output. (Contributed by Utkarsh Upadhyay in :issue:`30302`.)
Changes in the C API
--------------------
* The function :c:func:`PySlice_GetIndicesEx` is considered not safe for
resizable sequences. If the slice indices are not instances of :class:`int`,
but objects that implement the :meth:`!__index__` method, the sequence can be
resized after passing its length to :c:func:`!PySlice_GetIndicesEx`. This
can lead to returning indices out of the length of the sequence. For
avoiding possible problems use new functions :c:func:`PySlice_Unpack` and
:c:func:`PySlice_AdjustIndices`.
(Contributed by Serhiy Storchaka in :issue:`27867`.)
CPython bytecode changes
------------------------
...
...
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