473,465 Members | 1,419 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

A fix for OverflowError in 64bits platforms

Hi all,

I'm debugging a Plone site in an AMD64 laptop. When I first tried to run
Zope, I got this exception:

OverflowError: signed integer is greater than maximum

In the archives I encounter no solutions. This is what I could find, so
I share with you all:

It seems that on 64bit platforms, sys.maxint is much greater than list's
insertion maximum index. I'm not sure if this a bug in python or a
logical bound ---given the amount of RAM it would take to insert
9,223,372,036,854,775,807 items ;)--- Maybe a bug in the documentation,
though

However, Archetypes.Schema.moveField method documents the use of maxint
for inserting at the end of the Schema::
maxint can be used to move the field to the last position possible
>>from sys import maxint
spos = schema.copy()
spos.moveField('a', pos=maxint)
spos.keys()
['b', 'c', 'a']

I have seen this usage in some products. This raises and OverflowError
on 64bit platforms.

The fix is simple in the code of the caller::
from sys import maxint
if maxint >33: # Am I running on 64bits?
maxint = maxint >33
theschema.moveField(the_name, pos=maxint)

Now, the maxint variable holds an acceptable value.

I think the docstring should be appended with a "Note: On 64bits
platform this raises an OverflowError blah blah..."

Best regards,
Manuel.
Jul 3 '08 #1
0 975

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paolo Alexis Falcone | last post by:
Whenever I try to access a table with many rows using PgSQL's fetchall(), this happens: >>> from pyPgSQL import PgSQL >>> db = PgSQL.connect("192.168.0.8:5432:whitegold","dondon","dondon") >>>...
2
by: Luke | last post by:
Hi, I'm getting an OverflowError which doesn't make sense to me. Is this a python bug? Traceback (most recent call last): File "/home/demoau/lib/py/omniORB/__init__.py", line 717, in...
3
by: ashtonn | last post by:
Hello, I am trying to fill in a dword value into an array and i get an overflowerror Here's what iam trying to do. from array import * data = array('B', '\0' * 256) val = 0xFFFFFFFF
1
by: ashtonn | last post by:
How do i fill 1 byte and 4 bytes in a single array? This array contains packet information. Python code... from array import * size = 526 pData = array("B", '\0'* 526) # Destination MAC...
4
by: Sheldon | last post by:
Hi, I have a written a script that will check to see if the divisor is zero before executing but python will not allow this: if statistic_array > 0.0: statistic_array =...
2
by: Jorgen Bodde | last post by:
Hi List I am working on an app to store guitar songs I am practicing, and for the fun of it I want to store the date of songs when they were originally made. So far so good.. However, my...
1
by: khgoh | last post by:
Hi, Need help for the error "OverflowError: long int too large to convert to int" while reading a zip file content. Python version: Python 2.4.1 (#1, Sep 13 2005, 00:39:20) on linux2 Code...
0
by: Terry Reedy | last post by:
Manuel Vazquez Acosta wrote: In general, versions numbers for both Python and the app are helpful. Archives: Python? Zope? Plone? I hope you have/will report this to the appropriate...
5
by: Tzury Bar Yochay | last post by:
What is the reason math.pow yields OverflowError while python itself can calculate these large numbers. e.g: 1e+308 Traceback (most recent call last): File "<stdin>", line 1, in <module>...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.