From 888d975ac97310b7f669f94383fd5fe56716f71e Mon Sep 17 00:00:00 2001 From: matheusfgoncalves95 Date: Mon, 13 May 2024 02:11:08 +0200 Subject: [PATCH 1/3] Adding generator_stop to compile_future_features. Closes #4060 --- compiler/codegen/src/compile.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/compiler/codegen/src/compile.rs b/compiler/codegen/src/compile.rs index 9f4f3df82f..cdd78cc4a5 100644 --- a/compiler/codegen/src/compile.rs +++ b/compiler/codegen/src/compile.rs @@ -2903,9 +2903,15 @@ impl Compiler { for feature in features { match feature.name.as_str() { // Python 3 features; we've already implemented them by default - "nested_scopes" | "generators" | "division" | "absolute_import" - | "with_statement" | "print_function" | "unicode_literals" => {} - // "generator_stop" => {} + "nested_scopes" + | "generators" + | "division" + | "absolute_import" + | "with_statement" + | "print_function" + | "unicode_literals" + | "compile_future_features" => {} + "generator_stop" => {} "annotations" => self.future_annotations = true, other => { return Err(self.error(CodegenErrorType::InvalidFutureFeature(other.to_owned()))) From 28f407b37117c116f0e054e66ab572163242d505 Mon Sep 17 00:00:00 2001 From: matheusfgoncalves95 Date: Mon, 13 May 2024 03:32:27 +0200 Subject: [PATCH 2/3] Fixing typo and formatting --- compiler/codegen/src/compile.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/compiler/codegen/src/compile.rs b/compiler/codegen/src/compile.rs index cdd78cc4a5..7b912f43d2 100644 --- a/compiler/codegen/src/compile.rs +++ b/compiler/codegen/src/compile.rs @@ -2903,15 +2903,8 @@ impl Compiler { for feature in features { match feature.name.as_str() { // Python 3 features; we've already implemented them by default - "nested_scopes" - | "generators" - | "division" - | "absolute_import" - | "with_statement" - | "print_function" - | "unicode_literals" - | "compile_future_features" => {} - "generator_stop" => {} + "nested_scopes" | "generators" | "division" | "absolute_import" + | "with_statement" | "print_function" | "unicode_literals" | "generator_stop" => {} "annotations" => self.future_annotations = true, other => { return Err(self.error(CodegenErrorType::InvalidFutureFeature(other.to_owned()))) From 1a61186e80d3603e290fb734bf72db1ed70dca5b Mon Sep 17 00:00:00 2001 From: matheusfgoncalves95 Date: Mon, 13 May 2024 11:15:09 +0200 Subject: [PATCH 3/3] Removing expected failure from PEP 479 unit test. --- Lib/test/test_contextlib.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py index a9612c424f..71215ecf5d 100644 --- a/Lib/test/test_contextlib.py +++ b/Lib/test/test_contextlib.py @@ -197,8 +197,6 @@ class StopIterationSubclass(StopIteration): else: self.fail(f'{stop_exc} was suppressed') - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_contextmanager_except_pep479(self): code = """\ from __future__ import generator_stop