-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
bpo-40792: Make PyNumber_Index() always returning exact int. #20443
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
Changes from all commits
81eada1
f490144
dd50f51
166b0b4
aaa7b27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
The result of :c:func:`PyNumber_Index` now always has exact type :class:`int`. | ||
Previously, the result could have been an instance of a subclass of ``int``. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Attributes ``start``, ``stop`` and ``step`` of the :class:`range` object now | ||
always has exact type :class:`int`. Previously, they could have been an | ||
instance of a subclass of ``int``. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
The result of :func:`operator.index` now always has exact type :class:`int`. | ||
Previously, the result could have been an instance of a subclass of ``int``. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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'm missing something here: from my reading of the code,
PyLong_AsOff_t
is eitherPyLong_AsLong
orPyLong_AsLongLong
, and both of those already call_PyNumber_Index
, so it looks as though we don't need this call.Ah, I think I found what I'm missing:
PyLong_AsOff_t
could bePyLong_AsSsize_t
, which doesn't call_PyNumber_Index
. Is that right?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.
Yes, it is right.
It a separate question whether
PyLong_AsSsize_t
and others should call__index__
implicitly. It is not simple question, because such change may introduce bugs by making presumably atomic code non-atomic.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.
Agreed. It seems worth looking into, but not in this PR.