Old bug in longobject.c + fix

Paul Sheer psheer at icon.co.za
Mon Aug 19 23:32:09 CEST 2002

> >> > > I think that its pretty damn obvious the "nature" of the bug
> >> > 
> >> > No. How long would it take you to describe what your patch is
> >> > about? Two minutes? How long would it take a Python deve [...]
> >> 
> >> Actually, it takes about ten seconds to guess what the bug [...]
> > I am curious. What is this bug about? Can you just tell [...]
> > 
> I'm not entirely sure that I've got this right, but [...]

-	accum |= a->ob_digit[j] << remshift;
+	accum |= (twodigits) a->ob_digit[j] << remshift;

Its really VERY simple:

  accum is of type twodigits.

  The expression variable is of type digit.

  twodigits is (possibly) WIDER than digit, and

  THEREFORE you have to cast.

Any other discussion is irrelavent - it is a bug,
and it must be fixed.

OF COURSE this bug is not perceptable in current
builds - thousands of apps use left shifting. But
one day twodigits will be u_int64_t - so I've just
saved some future programmer many hours of debugging.

BTW, when this FINALLY gets patched (Python 8.0
I expect), then we can move twdigits over to
long long, and get the 80% speed increase I
have already demonstrated here in my kitchen.
Yeah yeah, I should have mentioned this.



More information about the Python-list mailing list