A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-August/068414.html below:

[Python-Dev] A cast from Py_ssize_t to long

[Python-Dev] A cast from Py_ssize_t to long [Python-Dev] A cast from Py_ssize_t to longAlexander Belopolsky alexander.belopolsky at gmail.com
Mon Aug 21 16:08:02 CEST 2006
On 8/21/06, Thomas Wouters <thomas at python.org> wrote:
[snip]
> > Is this a bug?
[snap]
> Yes. Py_ssize_t can be bigger than a long (on LLP64 systems, such as Win64).

Here is a similar problem:
typedef struct {
   ...
   size_t  pos;
   ...
} mmap_object;
...
mmap_tell_method(mmap_object *self, PyObject *unused)
{
        CHECK_VALID(NULL);
        return PyInt_FromLong((long) self->pos);
}

See Modules/mmapmodule.c .

Here a cast to ssize_t would, technically speaking, not be safe
either, but it may be worth using ssize_t anyways.

Is there a simple automated way to detect situations like this? Maybe
there is a win64 compiler that would generate a warning.
More information about the Python-Dev mailing list

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