-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-27867: Add a porting guide for PySlice_GetIndicesEx(). #1973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-27867: Add a porting guide for PySlice_GetIndicesEx(). #1973
Conversation
Doc/c-api/slice.rst
Outdated
@@ -53,6 +53,20 @@ Slice Objects | |||
|
|||
Returns ``0`` on success and ``-1`` on error with exception set. | |||
|
|||
.. note:: | |||
This function considered not safe for resizable sequences. Replace its invocation :: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a typo? Maybe is considered? Also there is a whitespace before ::
. I do not know if it is intentional, considering you apply the ::
without a whitespace in the sentence below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. Yes, this is a typo. A whitespace before ::
is intentional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The manual change looks good to me (could improve still), the what's new blurb is a tad confusing.
Doc/c-api/slice.rst
Outdated
@@ -53,6 +53,20 @@ Slice Objects | |||
|
|||
Returns ``0`` on success and ``-1`` on error with exception set. | |||
|
|||
.. note:: | |||
This function is considered not safe for resizable sequences. Replace its invocation :: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about "is considered not" v.s. "is not considered" for a while, but actually the former/current version as its semantics seem more appropriate
Doc/c-api/slice.rst
Outdated
// return error | ||
} | ||
|
||
with using functions :c:func:`PySlice_Unpack` and :c:func:`PySlice_AdjustIndices`:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You want to link to these functions here? It makes the sentence a bit of a roller coaster.
Could it be possible to move the "using ..." to after the code block? so:
with
if (Py [...]
using functions :c: ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or restructure it, so that the whole block is
"This function is considered not safe for resizable sequences. Its invocation should be replaced by a combination of :c:... and :c:... where
if (PySlice_Get[...]
is replaced by
if (PySlice_Unpack..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I'll restructure it.
Doc/whatsnew/3.7.rst
Outdated
Changes in the C API | ||
-------------------- | ||
|
||
* Function :c:func:`PySlice_GetIndicesEx` is considered not safe for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Function" -> "The function"
Doc/whatsnew/3.7.rst
Outdated
|
||
* Function :c:func:`PySlice_GetIndicesEx` is considered not safe for | ||
resizable sequences. It takes the current length of the sequence, but | ||
if the slice indices are not instances of :class:`int`, but objects that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"[...] instances of :class:int
" seems like an unended thoought. The double but in a row ("but if ..", "but objects") is quite confusing. Consider splitting into 2 or more sentences?
Thank you @cryvate for your review. |
No problem @serhiy-storchaka . Really like what you've changed it to. |
Doc/c-api/slice.rst
Outdated
|
||
is replaced by :: | ||
|
8000
||
if (PySlice_Unpack(slice, length, &start, &stop, &step) < 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove length
from argument list.
https://bugs.python.org/issue27867