Strange python behavior with modules on an emt64 box
jluben at exelixis.com
Mon Jan 23 11:06:01 EST 2006
To clarify this issue,
I checked, DCOracle is compile such that sizeof(int) = 4, sizeof(long) =
8. I guess this is closer to what you are expecting.
If a 'Python' int is a C long, then why is it passing in a 4 byte size?
Digging deaper, I've found that this size is not passed in by Python,
but by taking the sizeof() the long in a union for different types.
I guess this is now a GCC compiler bug, so I'll send this problem
From: python-list-bounces+jluben=exelixis.com at python.org
[mailto:python-list-bounces+jluben=exelixis.com at python.org] On Behalf Of
Sent: Friday, January 20, 2006 4:00 PM
To: python-list at python.org
Subject: Re: Strange python behavior with modules on an emt64 box
> I thought I would post this here first before seeking more experienced
> ears for this particular strangness.
> I have Python 2.4.2 installed from source on a dual processor dell
> These are x86_64 processors (verified by /bin/arch) (aka emt64
> uname -a gives
> Linux eps-linuxserv3 2.6.5-7.244-smp #1 SMP Mon Dec 12 18:32:25 UTC
> 2005 x86_64 x86_64 x86_64 GNU/Linux
> The flavor of Linux is 64 bit SUSE SLES 9 with the latest updates.
> Now for the strangeness. I'm using DCOracle2 (can't use anything else,
> as this is the corporate standard) also compiled from source. When
> executemany() when any parameter is of type int, I get a
> OverflowError. I turned on debug traces in DCOracle2; this indicated
> that PyArg_ParseTuple() was returning sizeof(int) = 4 bytes.
Sounds right to me. I don't know of any platform other than old Cray
Research boxes where sizeof(int) > 4.
> DCOracle2 is compiled such that sizeof(int) = 8 bytes.
Sounds wrong to me.
> Python itself gives,
> python -c "import sys; print sys.maxint"
> Therefore, indicating that the size of int is 8 bytes.
No, it does not. A Python `int` is a C `long`, and sizeof(long) = 8 on
most 64-bit boxes (Win64 is an exception). The size of a platform C
long can be deduced from the value of Python's sys.maxint, but nothing
about the size of a platform C int.
> So I'll go out on a limb here and assume that this is a python
> problem...but I don't know where to take it...
I'd start with this part, which sounds crazy:
DCOracle2 is compiled such that sizeof(int) = 8 bytes.
This email (including any attachments) may contain material that is confidential and privileged and is for the sole use of the intended recipient. Any review, reliance or distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
Exelixis, Inc. reserves the right, to the extent and under circumstances permitted by applicable law, to retain, monitor and intercept e-mail messages to and from its systems.
More information about the Python-list