summaryrefslogtreecommitdiffstats
path: root/Lib/email/Generator.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/email/Generator.py')
-rw-r--r--Lib/email/Generator.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/email/Generator.py b/Lib/email/Generator.py
index 9cce51c..6f17963 100644
--- a/Lib/email/Generator.py
+++ b/Lib/email/Generator.py
@@ -5,6 +5,7 @@
"""
import re
+import sys
import time
import locale
import random
@@ -356,11 +357,14 @@ class DecodedGenerator(Generator):
# Helper
+_width = len(repr(sys.maxint-1))
+_fmt = '%%0%dd' % _width
+
def _make_boundary(text=None):
# Craft a random boundary. If text is given, ensure that the chosen
# boundary doesn't appear in the text.
- dp = locale.localeconv().get('decimal_point', '.')
- boundary = ('=' * 15) + repr(random.random()).split(dp)[1] + '=='
+ token = random.randint(0, sys.maxint-1)
+ boundary = ('=' * 15) + (_fmt % token) + '=='
if text is None:
return boundary
b = boundary