A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2000-August/008269.html below:

[Python-Dev] can this overflow (list insertion)?

[Python-Dev] can this overflow (list insertion)? [Python-Dev] can this overflow (list insertion)?Vladimir Marangozov Vladimir.Marangozov@inrialpes.fr
Sun, 13 Aug 2000 11:16:50 +0200 (CEST)
Tim Peters wrote:
> 
> I think it's more relying on the product of two other assumptions:  (a)
> sizeof(int) >= 4, and (b) nobody is going to make a list with 2 billion
> elements in Python.  But you're right, sooner or later that's going to bite
> us.

+1 on your patch, but frankly, if we reach a situation to be bitten
by this overflow, chances are that we've already dumped core or will
be very soon -- billions of objects = soon to be overflowing
ob_refcnt integer counters. Py_None looks like a fine candidate for this.

Now I'm sure you're going to suggest again making the ob_refcnt a long,
as you did before <wink>.


> Suggest checking at the *start* of the routine instead:
> 
>        if (self->ob_size == INT_MAX) {
>               PyErr_SetString(PyExc_OverflowError,
>                       "cannot add more objects to list");
>               return -1;
>       }
> 
> Then the list isn't harmed.

-- 
       Vladimir MARANGOZOV          | Vladimir.Marangozov@inrialpes.fr
http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4