Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #109072

Re: Spurious issue in CPython 2.7.5

From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Spurious issue in CPython 2.7.5
Date 2016-05-25 03:23 +1000
Message-ID <mailman.62.1464110586.20402.python-list@python.org> (permalink)
References <779717266.18172.1464085350716.JavaMail.open-xchange@ox.netsite.dk> <mailman.52.1464090460.20402.python-list@python.org> <57448b9a$0$1584$c3e8da3$5496439d@news.astraweb.com> <CAPTjJmpSpQyVWaS12eNo74f8v-XpQ-iCo0DVSheh_KggoQQtdQ@mail.gmail.com>

Show all headers | View raw


On Wed, May 25, 2016 at 3:12 AM, Steven D'Aprano <steve@pearwood.info> wrote:
>>    2: In my process later on I get: "OverflowError: long too big to
>>    convert".
>
> Can you copy and paste the actual traceback rather than retyping it from
> memory? I think you're missing something, namely what the long is being
> converted to. The rest of the traceback will help too.
>
>
>>    This happens in different places and seems to always relate to
>>    obtaining a length of something (dict or list created by list
>>    comprehension). Fx
>>
>>    "for i in xrange(0, len_of_stuff, max_section_size):"
>>
>>    en_of_stuff is always less than the max long (around 600).
>
> What do you mean, "the max long"? Longs do not have a max value. The only
> limit is the amount of memory you have.

A Python long doesn't, but an ssize_t does. In certain places, Python
integers get converted into C integers, at which point an over-large
value triggers OverflowError.

>>> xrange(1<<100)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: Python int too large to convert to C long
>>> xrange(1,500,1<<100)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: Python int too large to convert to C long

(Note: Doesn't happen with a Py3 range object.)

But I echo the request for a copied and pasted error message.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Spurious issue in CPython 2.7.5 "thomas povtal.org" <thomas@povtal.org> - 2016-05-24 12:22 +0200
  Re: Spurious issue in CPython 2.7.5 Novocastrian_Nomad <gregory.j.baker@gmail.com> - 2016-05-24 08:05 -0700
    Re: Spurious issue in CPython 2.7.5 "thomas povtal.org" <thomas@povtal.org> - 2016-05-24 17:20 +0200
  Re: Spurious issue in CPython 2.7.5 Steven D'Aprano <steve@pearwood.info> - 2016-05-25 03:12 +1000
    Re: Spurious issue in CPython 2.7.5 Chris Angelico <rosuav@gmail.com> - 2016-05-25 03:23 +1000
    Re: Spurious issue in CPython 2.7.5 "thomas povtal.org" <thomas@povtal.org> - 2016-05-25 14:04 +0200
    Re: Spurious issue in CPython 2.7.5 Tim Golden <mail@timgolden.me.uk> - 2016-05-25 13:13 +0100
    Re: Spurious issue in CPython 2.7.5 "thomas povtal.org" <thomas@povtal.org> - 2016-05-25 14:26 +0200

csiph-web