472,951 Members | 1,823 Online

integer overflow

I got an odd error which I cannot explain and cannot seem to reproduce.
The following statement

lst[0] = num

produced this error

OverflowError: unsigned short is greater than maximum

The number was around 65536 so it makes sense that it would overflow a
short, but why is it trying to force it into a short integer?

Jul 18 '05 #1
5 5865
I got an odd error which I cannot explain and cannot seem to reproduce.
The following statement

lst[0] = num

produced this error

OverflowError: unsigned short is greater than maximum

The number was around 65536 so it makes sense that it would overflow a
short, but why is it trying to force it into a short integer?

Is lst an array.array('h') or something (numarray...)?

Cheers,
mwh

--
An encyclopedia is about being as accurate as it can, not being
evenly misinformed. -- Coby Beck, comp.lang.lisp
Jul 18 '05 #2
Michael Hudson wrote:

I got an odd error which I cannot explain and cannot seem to reproduce.
The following statement

lst[0] = num

produced this error

OverflowError: unsigned short is greater than maximum

The number was around 65536 so it makes sense that it would overflow a
short, but why is it trying to force it into a short integer?

Is lst an array.array('h') or something (numarray...)?

Nope, its just a regular list

Cheers,
mwh

Jul 18 '05 #3
Michael Hudson wrote:
I got an odd error which I cannot explain and cannot seem to reproduce.
The following statement

lst[0] = num

produced this error

OverflowError: unsigned short is greater than maximum

The number was around 65536 so it makes sense that it would overflow a
short, but why is it trying to force it into a short integer?

Is lst an array.array('h') or something (numarray...)?

Nope, its just a regular list

Cheers,
mwh

--
The snakes are optional, as are the electrodes, the molten lead
and the ritual buggering by syphilitic warthogs.
-- Tanuki the Raccoon-dog, asr
Jul 18 '05 #4
On Thu, Feb 05, 2004 at 10:58:28AM -0500, Chad Haynes wrote:
I got an odd error which I cannot explain and cannot seem to reproduce.
The following statement

lst[0] = num

produced this error

OverflowError: unsigned short is greater than maximum

The number was around 65536 so it makes sense that it would overflow a
short, but why is it trying to force it into a short integer?

import array
a = array.array('h', [0])
a[0] = 10000000

Traceback (most recent call last):
File "<stdin>", line 1, in ?
OverflowError: signed short integer is greater than maximum

Jp
Jul 18 '05 #5

"Chad Haynes" <ha*****@rockefeller.edu> wrote in message
news:_L********************@news.rockefeller.edu.. .
Michael Hudson wrote:
lst[0] = num

produced this error

OverflowError: unsigned short is greater than maximum

The number was around 65536 so it makes sense that it would overflow a
short, but why is it trying to force it into a short integer?

Is lst an array.array('h') or something (numarray...)?

Nope, its just a regular list

Suggestion: open interactive window, type in minimal lines of code needed
to reproduce error, then cut and post entire window, including header that
identifies your particular binary. Also mention the source of binary (who
compiled, you or someone else).

TJR

Jul 18 '05 #6

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