8000 bpo-27867: Add a porting guide for PySlice_GetIndicesEx(). by serhiy-storchaka · Pull Request #1973 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

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

Conversation

serhiy-storchaka
Copy link
Member
@serhiy-storchaka serhiy-storchaka commented Jun 6, 2017

@serhiy-storchaka serhiy-storchaka added the docs Documentation in the Doc dir label Jun 6, 2017
@@ -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 ::
Copy link
Contributor

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

Copy link
Member Author

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.

Copy link
Contributor
@cryvate cryvate left a 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.

@@ -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 ::
Copy link
Contributor

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

// return error
}

with using functions :c:func:`PySlice_Unpack` and :c:func:`PySlice_AdjustIndices`::
Copy link
Contributor

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: ...

Copy link
Contributor

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..."

Copy link
Member Author

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.

Changes in the C API
--------------------

* Function :c:func:`PySlice_GetIndicesEx` is considered not safe for
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Function" -> "The function"


* 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
Copy link
Contributor

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?

@serhiy-storchaka
Copy link
Member Author

Thank you @cryvate for your review.

@cryvate
Copy link
Contributor
cryvate commented Sep 23, 2017

No problem @serhiy-storchaka . Really like what you've changed it to.

8000

is replaced by ::

if (PySlice_Unpack(slice, length, &start, &stop, &step) < 0) {
Copy link
Contributor

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.

@serhiy-storchaka serhiy-storchaka merged commit 4d3f084 into python:master Oct 8, 2017
@serhiy-storchaka serhiy-storchaka deleted the PySlice_GetIndicesEx-porting-guide branch October 8, 2017 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0