[Python-Dev] New PEP: Using ssize_t as the index type

Neal Norwitz nnorwitz at gmail.com
Thu Jan 19 07:29:50 CET 2006

On 1/10/06, M.-A. Lemburg <mal at egenix.com> wrote:
> We'd also have to make sure that old extensions don't
> just import with a warning, since the change will introduce
> buffer overflows and seg faults in extensions that are not
> aware of the change.

I agree that on 64-bit platforms we should prevent the import.  In the
past we only provided a warning and the users were on their own.  This
is different.

If you read my massive checkin to check the return results of
Py_InitModule*(), you'll realize this isn't as simple as just failing
in Py_InitMethod*().  I was hoping to just modify Py_InitModule4() in
Python/modsupport.c to fail and return NULL.  That doesn't seem
practical given that we didn't check return results.  We will just
crash the interpreter with standard python 2.4 modules.

ISTM we need to modify _PyImport_LoadDynamicModule() in
Python/importdl.c before calling the init function (line 56, (*p)())
to check for some magic symbol that is defined only when compiling 2.5
and above.  For example we could add a static int  _64_bit_clean = 1;
in modsupport.h.  Without some trickery we will get this defined in
every .o file though, not just modules.

Other ideas?


More information about the Python-Dev mailing list