From 3b381e31552ac4121312c4b426e0ca7b6f178cd4 Mon Sep 17 00:00:00 2001 From: "benjamin.peterson" Date: Sun, 18 Jul 2010 14:36:12 +0000 Subject: [PATCH] remove support for byte literals; a new feature git-svn-id: http://svn.python.org/projects/python/branches/release31-maint@82956 6015fed2-1504-0410-9fe1-9d1591cc4771 --- Lib/ast.py | 2 +- Lib/test/test_ast.py | 1 - Misc/NEWS | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Lib/ast.py b/Lib/ast.py index 027302fefc..0b8baf752e 100644 --- a/Lib/ast.py +++ b/Lib/ast.py @@ -50,7 +50,7 @@ def literal_eval(node_or_string): if isinstance(node_or_string, Expression): node_or_string = node_or_string.body def _convert(node): - if isinstance(node, (Str, Bytes)): + if isinstance(node, Str): return node.s elif isinstance(node, Num): return node.n diff --git a/Lib/test/test_ast.py b/Lib/test/test_ast.py index e18888739e..7ee16bf5bd 100644 --- a/Lib/test/test_ast.py +++ b/Lib/test/test_ast.py @@ -271,7 +271,6 @@ class ASTHelpers_Test(unittest.TestCase): self.assertEqual(ast.literal_eval('[1, 2, 3]'), [1, 2, 3]) self.assertEqual(ast.literal_eval('{"foo": 42}'), {"foo": 42}) self.assertEqual(ast.literal_eval('(True, False, None)'), (True, False, None)) - self.assertEqual(ast.literal_eval('b"hi"'), b"hi") self.assertRaises(ValueError, ast.literal_eval, 'foo()') def test_literal_eval_issue4907(self): diff --git a/Misc/NEWS b/Misc/NEWS index 9ea62b9895..6a273d0a8e 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -83,8 +83,6 @@ Library - Issue #9243: Fix sndhdr module and add unit tests, contributed by James Lee. -- ``ast.literal_eval()`` now allows byte literals. - - Issue #9137: Fix issue in MutableMapping.update, which incorrectly treated keyword arguments called 'self' or 'other' specially. -- 2.11.4.GIT