mirror of
https://github.com/python/cpython.git
synced 2025-07-30 22:54:16 +00:00
remove support for byte literals; a new feature
This commit is contained in:
parent
7a502de6f8
commit
22dcfccee5
3 changed files with 1 additions and 4 deletions
|
@ -50,7 +50,7 @@ def literal_eval(node_or_string):
|
||||||
if isinstance(node_or_string, Expression):
|
if isinstance(node_or_string, Expression):
|
||||||
node_or_string = node_or_string.body
|
node_or_string = node_or_string.body
|
||||||
def _convert(node):
|
def _convert(node):
|
||||||
if isinstance(node, (Str, Bytes)):
|
if isinstance(node, Str):
|
||||||
return node.s
|
return node.s
|
||||||
elif isinstance(node, Num):
|
elif isinstance(node, Num):
|
||||||
return node.n
|
return node.n
|
||||||
|
|
|
@ -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('[1, 2, 3]'), [1, 2, 3])
|
||||||
self.assertEqual(ast.literal_eval('{"foo": 42}'), {"foo": 42})
|
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('(True, False, None)'), (True, False, None))
|
||||||
self.assertEqual(ast.literal_eval('b"hi"'), b"hi")
|
|
||||||
self.assertRaises(ValueError, ast.literal_eval, 'foo()')
|
self.assertRaises(ValueError, ast.literal_eval, 'foo()')
|
||||||
|
|
||||||
def test_literal_eval_issue4907(self):
|
def test_literal_eval_issue4907(self):
|
||||||
|
|
|
@ -83,8 +83,6 @@ Library
|
||||||
|
|
||||||
- Issue #9243: Fix sndhdr module and add unit tests, contributed by James Lee.
|
- 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
|
- Issue #9137: Fix issue in MutableMapping.update, which incorrectly
|
||||||
treated keyword arguments called 'self' or 'other' specially.
|
treated keyword arguments called 'self' or 'other' specially.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue