[Python-Dev] 32 bit to 64 bit migration of C-API(Python) (original) (raw)
abhishek goswami zeal_goswami at yahoo.com
Sun Jan 27 07:31:28 CET 2013
- Previous message: [Python-Dev] 32 bit to 64 bit migration of C-API(Python)
- Next message: [Python-Dev] [Python-checkins] cpython: Touch up exception messaging
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Nick, Thanks a lot for your quick responce
Thanks Abhishek Goswami Bangalore Phone No -07829580867/9962270999 Skype : abhishekgoswami1
From: Nick Coghlan <ncoghlan at gmail.com> To: abhishek goswami <zeal_goswami at yahoo.com> Cc: "python-dev at python.org" <python-dev at python.org> Sent: Sunday, 27 January 2013 11:46 AM Subject: Re: [Python-Dev] 32 bit to 64 bit migration of C-API(Python)
On Sun, Jan 27, 2013 at 3:42 PM, abhishek goswami <zeal_goswami at yahoo.com> wrote:
Hi, I am working in Python-C ApI (Integrated Project). The Project has migrated to 64 bit machine from 32 bit machine. Every thing was working fine in 32 bit machine. But we getting following error in 64 bit machine. " Python int too large to convert to C long".
Hi Abhishek,
python-dev is for the development of CPython, rather than development with CPython (including the C API). More appropriate places for this question are the general python-list mailing list or the C API special interest group.
However, from the sounds of it, you are running into trouble with the fact that on a 64-bit machine, Python stores many internal values as "Py_ssize_t" (which is always 8 bytes on a 64 bit machine), rather than a C int or long. PEP 353 [1] describes the background for this change, which allows Python containers to exploit the full size of the address space on 64-bit systems.
C API functions that may be of interest in that context include: http://docs.python.org/2/c-api/number.html#PyNumber_AsSsize_t http://docs.python.org/2/c-api/int.html#PyInt_FromSsize_t http://docs.python.org/2/c-api/int.html#PyInt_AsSsize_t http://docs.python.org/2/c-api/long.html#PyLong_FromSsize_t http://docs.python.org/2/c-api/long.html#PyLong_AsSsize_t As well as the "n" format character for argument processing http://docs.python.org/2/c-api/arg.html#parsing-arguments-and-building-values
[1] http://www.python.org/dev/peps/pep-0353/
Regards, Nick.
-- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20130127/3b0214c0/attachment.html>
- Previous message: [Python-Dev] 32 bit to 64 bit migration of C-API(Python)
- Next message: [Python-Dev] [Python-checkins] cpython: Touch up exception messaging
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]