[Patches] [ python-Patches-668124 ] struct.pack("I", -3) doesn't raise an exception

SourceForge.net noreply@sourceforge.net
Thu, 16 Jan 2003 08:16:44 -0800


Patches item #668124, was opened at 2003-01-14 15:39
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=668124&group_id=5470

Category: Modules
Group: None
Status: Open
Resolution: Accepted
Priority: 5
Submitted By: Thomas Heller (theller)
Assigned to: Thomas Heller (theller)
>Summary: struct.pack("I", -3) doesn't raise an exception

Initial Comment:
Each time I try to 'steal' code from Python, I seem to 
find a bug ;-)

This bug is also in 2.2.

----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2003-01-16 11:16

Message:
Logged In: YES 
user_id=31435

This should definitely be brought up on Python-Dev.  The 
rules for what struct will and won't accept are an historical 
minefield, and if "I" stops accepting negative Python (short) 
ints, I expect lots of code would break.

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2003-01-16 10:55

Message:
Logged In: YES 
user_id=33168

Oops, I spoke too soon.  test_grammar failed -- max negative int
Not sure if that's a test problem or something else, but it
needs to be addressed.

----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2003-01-16 10:54

Message:
Logged In: YES 
user_id=33168

I'm convinced it's a bug.  The patch is fine, but a NEWS
item and test should also be added.

----------------------------------------------------------------------

Comment By: Thomas Heller (theller)
Date: 2003-01-16 05:26

Message:
Logged In: YES 
user_id=11105

Don't know if this is a bug or not (and to be honest, I don't 
care). I just have the habit to report these things when I find 
them.

IMO it's at least inconsitent that all the unsigned format 
codes "HLQ" don't accept negative numbers, but "IL" do.


----------------------------------------------------------------------

Comment By: Neal Norwitz (nnorwitz)
Date: 2003-01-15 17:21

Message:
Logged In: YES 
user_id=33168

This didn't raise an exception in 2.1.1 either.  Is this
really a bug or just the behaviour?  Should the fix be to update
doc rather than code?  Don't you need to fix get_ulonglong()
in a similar way?

I'm not necessarily against the patch, perhaps this should
be brought up on python-dev?

If the patch is accepted, you need to make a NEWS entry, and
probably should update libstruct.tex.

----------------------------------------------------------------------

Comment By: Thomas Heller (theller)
Date: 2003-01-14 15:42

Message:
Logged In: YES 
user_id=11105

This is an upper-case 'i', meaning 'unsigned int'.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=668124&group_id=5470