[Python-Dev] New PEP: Using ssize_t as the index type (original) (raw)
M.-A. Lemburg mal at egenix.com
Thu Jan 19 10🔞58 CET 2006
- Previous message: [Python-Dev] New PEP: Using ssize_t as the index type
- Next message: [Python-Dev] New PEP: Using ssize_t as the index type
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Neal Norwitz wrote:
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 PyInitModule*(), you'll realize this isn't as simple as just failing in PyInitMethod*(). I was hoping to just modify PyInitModule4() 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 PyImportLoadDynamicModule() 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 64bitclean = 1; in modsupport.h. Without some trickery we will get this defined in every .o file though, not just modules. Other ideas?
We could explicitly break binary compatibility for Python 2.5 on 64-bit platforms, by changing the name of an often used API, e.g. the Py_InitModule*() APIs.
This is how Unicode does it - we map the various APIs to either ...UCS2 or ...UCS4, so that you cannot import an extension compiled for e.g. UCS2 into a Python interpreter compiled for UCS4. If we didn't, you'd get seg faults and buffer overflows the same way you would with the ssize_t change on 64-bit platforms.
-- Marc-Andre Lemburg eGenix.com
Professional Python Services directly from the Source (#1, Jan 19 2006)
Python/Zope Consulting and Support ... http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
- Previous message: [Python-Dev] New PEP: Using ssize_t as the index type
- Next message: [Python-Dev] New PEP: Using ssize_t as the index type
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]