This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients LambertDW, Rhamphoryncus, chemacortes, jcea, mark.dickinson, pitrou, rhettinger
Date 2009-02-12.11:54:23
SpamBayes Score 2.19706e-05
Marked as misclassified No
Message-id <>
> Well, I had memories of a weird signed/unsigned problem (issue4935) and
> I wasn't sure whether it could raise its head in the present case or
> not.

I'm 99.9% sure that it's not a problem here.  If it is a problem then it
needs to be fixed in long_hash in longobject.c as well, which uses
exactly the same code.

The relevant section of the C99 standard is, para. 1 (try
googling for 'n1256' if you don't have a copy of the standard).  The
only really nasty cases are those of the form unsigned_int +
signed_long, or more generally,

low_rank_unsigned_integer binary_op higher_rank_signed_integer

where the type of the expression depends on the relative sizes (not just
ranks) of the integer types, giving potential portability problems.  And
there are similar problems with the integer promotions (, para. 2).

I guess it comes down to personal taste, but my own preference is to
leave out casts where the conversion they describe is already implied by
the C language rules, adding them back in to silence compiler warnings
if necessary.  I find it reduces noise in the code and makes the
important casts more visible, but chacun à son goût.
Date User Action Args
2009-02-12 11:54:26mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, jcea, chemacortes, Rhamphoryncus, pitrou, LambertDW
2009-02-12 11:54:26mark.dickinsonsetmessageid: <>
2009-02-12 11:54:24mark.dickinsonlinkissue5186 messages
2009-02-12 11:54:23mark.dickinsoncreate