Manuel Vazquez Acosta wrote:
Quote:
Hi all,
>
I'm debugging a Plone site in an AMD64 laptop. When I first tried to run
Zope, I got this exception:
In general, versions numbers for both Python and the app are helpful.
Quote:
OverflowError: signed integer is greater than maximum
>
In the archives I encounter no solutions.
Archives: Python? Zope? Plone?
Quote:
This is what I could find, so I share with you all:
I hope you have/will report this to the appropriate place.
Quote:
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
This strikes me as an app bug. In any case, released versions of Python
will not change.
Quote:
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
This is a bit flakey. If they are going to use a surrogate for
len(schemalist)-1, they might as well accept anything larger and shrink
it to the proper value as slicing does.
In 2.5.2
Quote:
Quote:
Quote:
>>a=[1,2,3]
>>a[1:1000000000000000000000]
[2, 3]
Quote:
Quote:
Quote:
>>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..."
Better to fix it ;-)