From 80bdb4841cca58ee62935a3fa24e4cebc0b8335c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Sun, 2 Mar 2008 17:15:58 +0000 Subject: Revert r52798, r52803, r52824, r54342, as they don't fix security issues. --- Lib/email/Charset.py | 6 +++--- Lib/email/__init__.py | 6 +++--- Lib/fileinput.py | 4 +--- Lib/test/test_sha.py | 19 +------------------ Lib/uu.py | 4 ---- 5 files changed, 8 insertions(+), 31 deletions(-) diff --git a/Lib/email/Charset.py b/Lib/email/Charset.py index 0751abf..fb4e5a9 100644 --- a/Lib/email/Charset.py +++ b/Lib/email/Charset.py @@ -1,5 +1,5 @@ -# Copyright (C) 2001-2007 Python Software Foundation -# Author: email-sig@python.org +# Copyright (C) 2001-2006 Python Software Foundation +# Author: che@debian.org (Ben Gertzfield), barry@python.org (Barry Warsaw) from types import UnicodeType from email.Encoders import encode_7or8bit @@ -99,7 +99,7 @@ ALIASES = { # of stability and useability. CODEC_MAP = { - 'gb2312': 'eucgb2312_cn', + 'gb2132': 'eucgb2312_cn', 'big5': 'big5_tw', 'utf-8': 'utf-8', # Hack: We don't want *any* conversion for stuff marked us-ascii, as all diff --git a/Lib/email/__init__.py b/Lib/email/__init__.py index 1531140..1e03b00 100644 --- a/Lib/email/__init__.py +++ b/Lib/email/__init__.py @@ -1,9 +1,9 @@ -# Copyright (C) 2001-2007 Python Software Foundation -# Author: email-sig@python.org +# Copyright (C) 2001-2006 Python Software Foundation +# Author: barry@python.org (Barry Warsaw) """A package for parsing, handling, and generating email messages.""" -__version__ = '2.5.9' +__version__ = '2.5.8' __all__ = [ 'base64MIME', diff --git a/Lib/fileinput.py b/Lib/fileinput.py index 7593858..27ccc3b 100644 --- a/Lib/fileinput.py +++ b/Lib/fileinput.py @@ -301,9 +301,7 @@ class FileInput: self._file = open(self._backupfilename, "r") try: perm = os.fstat(self._file.fileno()).st_mode - except (AttributeError, OSError): - # AttributeError occurs in Jython, where there's no - # os.fstat. + except OSError: self._output = open(self._filename, "w") else: fd = os.open(self._filename, diff --git a/Lib/test/test_sha.py b/Lib/test/test_sha.py index ea224e4..c438cc6 100644 --- a/Lib/test/test_sha.py +++ b/Lib/test/test_sha.py @@ -11,23 +11,9 @@ from test import test_support class SHATestCase(unittest.TestCase): def check(self, data, digest): - # Check digest matches the expected value - obj = sha.new(data) - computed = obj.hexdigest() + computed = sha.new(data).hexdigest() self.assert_(computed == digest) - # Verify that the value doesn't change between two consecutive - # digest operations. - computed_again = obj.hexdigest() - self.assert_(computed == computed_again) - - # Check hexdigest() output matches digest()'s output - digest = obj.digest() - hexd = "" - for c in digest: - hexd += '%02x' % ord(c) - self.assert_(computed == hexd) - def test_case_1(self): self.check("abc", "a9993e364706816aba3e25717850c26c9cd0d89d") @@ -40,9 +26,6 @@ class SHATestCase(unittest.TestCase): self.check("a" * 1000000, "34aa973cd4c4daa4f61eeb2bdbad27316534016f") - def test_case_4(self): - self.check(chr(0xAA) * 80, - '4ca0ef38f1794b28a8f8ee110ee79d48ce13be25') def test_main(): test_support.run_unittest(SHATestCase) diff --git a/Lib/uu.py b/Lib/uu.py index fd3e327..f591798 100755 --- a/Lib/uu.py +++ b/Lib/uu.py @@ -115,7 +115,6 @@ def decode(in_file, out_file=None, mode=None, quiet=0): # # Open the output file # - opened = False if out_file == '-': out_file = sys.stdout elif isinstance(out_file, StringType): @@ -125,7 +124,6 @@ def decode(in_file, out_file=None, mode=None, quiet=0): except AttributeError: pass out_file = fp - opened = True # # Main decoding loop # @@ -143,8 +141,6 @@ def decode(in_file, out_file=None, mode=None, quiet=0): s = in_file.readline() if not s: raise Error, 'Truncated input file' - if opened: - out_file.close() def test(): """uuencode/uudecode main program""" -- cgit v0.12