8000 Parse Python 3.9+ parenthesized context managers · andersk/RustPython@b7f4ff7 · GitHub
[go: up one dir, main page]

Skip to content

Commit b7f4ff7

Browse files
committed
Parse Python 3.9+ parenthesized context managers
Since the upstream grammar for this is not LR(1), we abuse LALRPOP macros and the Into/TryInto traits to build a cover grammar that converts to either tuples or `with` items after additional validation. It’s annoying and ugly, but something like this is basically our only option short of switching to a more powerful parser algorithm. Fixes RustPython#4145. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
1 parent 78ca48c commit b7f4ff7

File tree

5 files changed

+2413
-92
lines changed

5 files changed

+2413
-92
lines changed

Lib/test/test_ensurepip.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ def touch(self, directory, filename):
1616
fullname = os.path.join(directory, filename)
1717
open(fullname, "wb").close()
1818

19-
# TODO: RUSTPYTHON
20-
@unittest.expectedFailure
2119
def test_version(self):
2220
# Test version()
2321
with tempfile.TemporaryDirectory() as tmpdir:
@@ -27,8 +25,6 @@ def test_version(self):
2725
unittest.mock.patch.object(ensurepip, '_WHEEL_PKG_DIR', tmpdir)):
2826
self.assertEqual(ensurepip.version(), '1.2.3b1')
2927

30-
# TODO: RUSTPYTHON
31-
@unittest.expectedFailure
3228
def test_get_packages_no_dir(self):
3329
# Test _get_packages() without a wheel package directory
3430
with (unittest.mock.patch.object(ensurepip, '_PACKAGES', None),
@@ -42,8 +38,6 @@ def test_get_packages_no_dir(self):
4238
self.assertIsNotNone(packages['pip'].wheel_name)
4339
self.assertIsNotNone(packages['setuptools'].wheel_name)
4440

45-
# TODO: RUSTPYTHON
46-
@unittest.expectedFailure
4741
def test_get_packages_with_dir(self):
4842
# Test _get_packages() with a wheel package directory
4943
setuptools_filename = "setuptools-49.1.3-py3-none-any.whl"

0 commit comments

Comments
 (0)
0