diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2020-05-28 07:33:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-28 07:33:45 (GMT) |
commit | 5f4b229df7812f1788287095eb6b138bb21876a4 (patch) | |
tree | f00cef402d0467010a34e9e617d89ccebebe6d1a /Misc | |
parent | eaca2aa117d663acf8160a0b4543ee2c7006fcc7 (diff) | |
download | cpython-5f4b229df7812f1788287095eb6b138bb21876a4.zip cpython-5f4b229df7812f1788287095eb6b138bb21876a4.tar.gz cpython-5f4b229df7812f1788287095eb6b138bb21876a4.tar.bz2 |
bpo-40792: Make the result of PyNumber_Index() always having exact type int. (GH-20443)
Previously, the result could have been an instance of a subclass of int.
Also revert bpo-26202 and make attributes start, stop and step of the range
object having exact type int.
Add private function _PyNumber_Index() which preserves the old behavior
of PyNumber_Index() for performance to use it in the conversion functions
like PyLong_AsLong().
Diffstat (limited to 'Misc')
3 files changed, 7 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/C API/2020-05-27-11-02-15.bpo-40792.pBw2Bb.rst b/Misc/NEWS.d/next/C API/2020-05-27-11-02-15.bpo-40792.pBw2Bb.rst new file mode 100644 index 0000000..4cfe09b --- /dev/null +++ b/Misc/NEWS.d/next/C API/2020-05-27-11-02-15.bpo-40792.pBw2Bb.rst @@ -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``. diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-05-27-22-37-58.bpo-40792.WEDqqU.rst b/Misc/NEWS.d/next/Core and Builtins/2020-05-27-22-37-58.bpo-40792.WEDqqU.rst new file mode 100644 index 0000000..5986a22 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-05-27-22-37-58.bpo-40792.WEDqqU.rst @@ -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``. diff --git a/Misc/NEWS.d/next/Library/2020-05-27-22-19-42.bpo-40792.87Yx01.rst b/Misc/NEWS.d/next/Library/2020-05-27-22-19-42.bpo-40792.87Yx01.rst new file mode 100644 index 0000000..032a96c --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-05-27-22-19-42.bpo-40792.87Yx01.rst @@ -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``. |