By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,199 Members | 1,120 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,199 IT Pros & Developers. It's quick & easy.

integer overflow

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a

"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.