]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-40792: Make the result of PyNumber_Index() always having exact type int. (GH...
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 28 May 2020 07:33:45 +0000 (10:33 +0300)
committerGitHub <noreply@github.com>
Thu, 28 May 2020 07:33:45 +0000 (10:33 +0300)
commit5f4b229df7812f1788287095eb6b138bb21876a4
treef00cef402d0467010a34e9e617d89ccebebe6d1a
parenteaca2aa117d663acf8160a0b4543ee2c7006fcc7
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().
51 files changed:
Doc/c-api/number.rst
Doc/library/operator.rst
Doc/whatsnew/3.10.rst
Include/cpython/abstract.h
Lib/copy.py
Lib/test/clinic.test
Lib/test/test_copy.py
Lib/test/test_range.py
Misc/NEWS.d/next/C API/2020-05-27-11-02-15.bpo-40792.pBw2Bb.rst [new file with mode: 0644]
Misc/NEWS.d/next/Core and Builtins/2020-05-27-22-37-58.bpo-40792.WEDqqU.rst [new file with mode: 0644]
Misc/NEWS.d/next/Library/2020-05-27-22-19-42.bpo-40792.87Yx01.rst [new file with mode: 0644]
Modules/_io/_iomodule.c
Modules/_io/clinic/bufferedio.c.h
Modules/_io/clinic/bytesio.c.h
Modules/_io/clinic/iobase.c.h
Modules/_io/clinic/stringio.c.h
Modules/_io/clinic/textio.c.h
Modules/_struct.c
Modules/arraymodule.c
Modules/clinic/_bisectmodule.c.h
Modules/clinic/_bz2module.c.h
Modules/clinic/_collectionsmodule.c.h
Modules/clinic/_elementtree.c.h
Modules/clinic/_hashopenssl.c.h
Modules/clinic/_lzmamodule.c.h
Modules/clinic/_operator.c.h
Modules/clinic/_sre.c.h
Modules/clinic/_struct.c.h
Modules/clinic/arraymodule.c.h
Modules/clinic/audioop.c.h
Modules/clinic/itertoolsmodule.c.h
Modules/clinic/posixmodule.c.h
Modules/clinic/zlibmodule.c.h
Modules/mathmodule.c
Modules/posixmodule.c
Objects/abstract.c
Objects/bytesobject.c
Objects/clinic/bytearrayobject.c.h
Objects/clinic/bytesobject.c.h
Objects/clinic/listobject.c.h
Objects/clinic/longobject.c.h
Objects/clinic/unicodeobject.c.h
Objects/floatobject.c
Objects/longobject.c
Objects/memoryobject.c
Objects/stringlib/clinic/transmogrify.h.h
Objects/typeobject.c
Objects/unicodeobject.c
Python/clinic/_warnings.c.h
Python/getargs.c
Tools/clinic/clinic.py