Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue28876

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:bool of large range raises OverflowError
Type:behaviorStage:resolved
Components:Interpreter CoreVersions:Python 3.7, Python 3.6, Python 3.5
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To: rhettingerNosy List: akira, mark.dickinson, methane, rhettinger, serhiy.storchaka
Priority:normalKeywords:patch

Created on2016-12-05 09:37 bymark.dickinson, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
range_bool.patchakira,2016-12-05 12:27
range_bool-no_docs.patchakira,2016-12-06 07:50no docs updates
range_bool-c99-designated-initializers.patchakira,2017-01-22 13:17use c99 designated initializers
range_bool-c99-designated-initializers-indent.patchakira,2017-01-23 15:00use 4-space indent, space around "="
Pull Requests
URLStatusLinkedEdit
PR 699mergedakira,2017-03-17 19:31
PR 734mergedserhiy.storchaka,2017-03-20 06:48
PR 735mergedserhiy.storchaka,2017-03-20 07:13
Messages (18)
msg282402 -(view)Author: Mark Dickinson (mark.dickinson)*(Python committer)Date: 2016-12-05 09:37
The bool of a large range raises OverflowError:    >>> bool(range(2**63))    Traceback (most recent call last):      File "<stdin>", line 1, in <module>    OverflowError: Python int too large to convert to C ssize_tThis is a side-effect of len raising OverflowError, which is a general problem that's nontrivial to fix (the sq_length slot is constrained to return a ssize_t). In theory, though, it would be possible to implement nb_bool for range objects to do the right thing.In practice, this may well not be worth fixing, though I think it's at least worth reporting.
msg282405 -(view)Author: Raymond Hettinger (rhettinger)*(Python committer)Date: 2016-12-05 09:54
+1 for implementing nb_bool for range objects.
msg282414 -(view)Author: Akira Li (akira)*Date: 2016-12-05 12:27
Here's a patch with range_bool() implementation, tests and the docs update.I'm not sure how it should be documented. I've specified it as versionchanged:: 3.6
msg282418 -(view)Author: Mark Dickinson (mark.dickinson)*(Python committer)Date: 2016-12-05 13:13
> I'm not sure how it should be documented.I think a change at this level probably isn't worth documenting in the official docs; it's enough that there's aMisc/NEWS entry for it.
msg282506 -(view)Author: Akira Li (akira)*Date: 2016-12-06 07:50
I've removed the documentation changes from the patch.
msg283137 -(view)Author: Mark Dickinson (mark.dickinson)*(Python committer)Date: 2016-12-13 19:46
Patch LGTM. You could safely drop the initialisers beyond `nb_bool` in the `range_as_number` struct (per C99 6.7.8p21), but it's fine as it is.
msg286008 -(view)Author: Akira Li (akira)*Date: 2017-01-22 13:17
Following the python-dev discussion [1] I've added a variant of the patch that uses c99 designated initializers [2][1]https://mail.python.org/pipermail/python-dev/2017-January/147175.html[2]https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
msg286048 -(view)Author: Raymond Hettinger (rhettinger)*(Python committer)Date: 2017-01-23 05:50
This patch looks ready to go.  I'll wait a bit to see it there are any other comments.  If not, I'll apply it shortly.
msg286055 -(view)Author: Inada Naoki (methane)*(Python committer)Date: 2017-01-23 07:32
LGTM, except 2-space indent.
msg286089 -(view)Author: Akira Li (akira)*Date: 2017-01-23 15:00
I've updated the patch to use 4-space indent (pep-7).I've added space around "=" (pep-7); unlike the usual"dict(designator=value)" -- no space around "=" for keyword argument(pep-8).
msg286092 -(view)Author: Mark Dickinson (mark.dickinson)*(Python committer)Date: 2017-01-23 16:15
Latest patch LGTM too.
msg289772 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-03-17 17:27
Akira, could you open a pull request on GitHub?
msg289778 -(view)Author: Akira Li (akira)*Date: 2017-03-17 19:40
> Akira, could you open a pull request on GitHub?Done.PR 699
msg289786 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-03-17 21:09
Inissue29840 proposed an alternate and more general solution. But I think that nb_bool should be implemented for range objects sinceissue29840 is 3.7 only and nb_bool is faster.
msg289876 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-03-20 07:39
Thank you Akira for your patch.
msg290129 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-03-24 20:18
New changeset4276068fe57e93b4c8d428f0b1cde8ca04b8fb99 by Serhiy Storchaka in branch '3.5':bpo-28876: bool of large range raises OverflowError (#699) (#735)https://github.com/python/cpython/commit/4276068fe57e93b4c8d428f0b1cde8ca04b8fb99
msg290130 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-03-24 20:18
New changeset6fad4090ec9a27f8572bb00661b9890f01fb62f7 by Serhiy Storchaka in branch '3.6':bpo-28876: bool of large range raises OverflowError (#699) (#734)https://github.com/python/cpython/commit/6fad4090ec9a27f8572bb00661b9890f01fb62f7
msg290132 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-03-24 20:18
New changesete46fb8611867fa3b407a813f53137929b7cb4a10 by Serhiy Storchaka (4kir4) in branch 'master':bpo-28876: bool of large range raises OverflowError (#699)https://github.com/python/cpython/commit/e46fb8611867fa3b407a813f53137929b7cb4a10
History
DateUserActionArgs
2022-04-11 14:58:40adminsetgithub: 73062
2017-03-24 20:18:43serhiy.storchakasetmessages: +msg290132
2017-03-24 20:18:24serhiy.storchakasetmessages: +msg290130
2017-03-24 20:18:15serhiy.storchakasetmessages: +msg290129
2017-03-20 07:39:08serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: +msg289876

stage: patch review -> resolved
2017-03-20 07:13:20serhiy.storchakasetpull_requests: +pull_request649
2017-03-20 06:48:06serhiy.storchakasetpull_requests: +pull_request648
2017-03-17 21:09:22serhiy.storchakasetmessages: +msg289786
stage: needs patch -> patch review
2017-03-17 19:40:39akirasetmessages: +msg289778
2017-03-17 19:31:41akirasetpull_requests: +pull_request572
2017-03-17 17:27:35serhiy.storchakasetmessages: +msg289772
2017-03-17 08:36:16serhiy.storchakalinkissue29833 dependencies
2017-01-23 16:15:21mark.dickinsonsetmessages: +msg286092
2017-01-23 15:00:58akirasetfiles: +range_bool-c99-designated-initializers-indent.patch

messages: +msg286089
2017-01-23 07:32:28methanesetnosy: +methane
messages: +msg286055
2017-01-23 05:50:15rhettingersetassignee:rhettinger
messages: +msg286048
2017-01-22 13:17:19akirasetfiles: +range_bool-c99-designated-initializers.patch

messages: +msg286008
2016-12-13 19:46:41mark.dickinsonsetmessages: +msg283137
2016-12-06 07:50:44akirasetfiles: +range_bool-no_docs.patch

messages: +msg282506
2016-12-05 13:13:09mark.dickinsonsetmessages: +msg282418
2016-12-05 12:27:37akirasetfiles: +range_bool.patch

nosy: +akira
messages: +msg282414

keywords: +patch
2016-12-05 10:47:43serhiy.storchakasetnosy: +serhiy.storchaka

stage: needs patch
2016-12-05 09:54:59rhettingersetnosy: +rhettinger
messages: +msg282405
2016-12-05 09:37:42mark.dickinsoncreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp