471,350 Members | 1,685 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

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?

-Chad
Jul 18 '05 #1
5 5725
Chad Haynes <ha*****@rockefeller.edu> writes:
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:
Chad Haynes <ha*****@rockefeller.edu> writes:

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
Chad Haynes <ha*****@rockefeller.edu> writes:
Michael Hudson wrote:
Chad Haynes <ha*****@rockefeller.edu> writes:
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


Code, please.

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:
Chad Haynes <ha*****@rockefeller.edu> writes:
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by John Black | last post: by
2 posts views Thread by REH | last post: by
25 posts views Thread by Ashutosh Iddya | last post: by
25 posts views Thread by junky_fellow | last post: by
9 posts views Thread by Chris Botha | last post: by
40 posts views Thread by Robert Seacord | last post: by
13 posts views Thread by Freaker85 | last post: by
42 posts views Thread by thomas.mertes | last post: by
6 posts views Thread by Chris Becke | last post: by

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.