[Python-bugs-list] [ python-Bugs-745478 ] Buglet in email/Generator.py (2.2.3c1!)

SourceForge.net noreply@sourceforge.net
Thu, 29 May 2003 06:04:07 -0700


Bugs item #745478, was opened at 2003-05-29 08:08
Message generated for change (Comment added) made by bwarsaw
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=745478&group_id=5470

Category: Python Library
Group: Python 2.2.2
Status: Open
Resolution: None
>Priority: 9
Submitted By: Geert Jansen (geertj)
>Assigned to: Barry A. Warsaw (bwarsaw)
Summary: Buglet in email/Generator.py (2.2.3c1!)

Initial Comment:
Hi,

there seems to be a bug in the "email" package, 
file "Generator.py". At line 362, a random digit string is 
needed. This is done like this:

  dp = locale.localeconv().get('decimal_point')
  r = repr(random.random()).split(dp)[1]

The problem is that repr() doesn't use the locale, so 
when the decimal_point is not equal to ".", split() returns 
only one entry and the [1] index fails.

Suggested fix: either use:

  r = repr(random.random())[1:]

or:

  r = repr(random.randint(0, sys.maxint-1))

The same problem is in 2.3b1.

Geert

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

>Comment By: Barry A. Warsaw (bwarsaw)
Date: 2003-05-29 09:04

Message:
Logged In: YES 
user_id=12800

Cranking priority to 9 so this has to get fixed before 2.2.3

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

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