]> granicus.if.org Git - python/commitdiff
remove support for byte literals; a new feature
authorBenjamin Peterson <benjamin@python.org>
Sun, 18 Jul 2010 14:36:12 +0000 (14:36 +0000)
committerBenjamin Peterson <benjamin@python.org>
Sun, 18 Jul 2010 14:36:12 +0000 (14:36 +0000)
Lib/ast.py
Lib/test/test_ast.py
Misc/NEWS

index 027302fefcb0943bd25290fd584acb0c4ab167fe..0b8baf752e04e763e9d05394cbfaad8a0a3403f1 100644 (file)
@@ -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
index e18888739e0dc290f9bb810a4992fbe89a012f1b..7ee16bf5bd601b951472108f14ea9a0c398e4236 100644 (file)
@@ -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):
index 9ea62b989515c8525224fb072a50e1580363a6b5..6a273d0a8e25771e00032d45e53a1c85557ccd46 100644 (file)
--- 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.