From 67dcb1519dc83f02272ff4cc303903f66ec449ed Mon Sep 17 00:00:00 2001 From: Jukka Lehtosalo Date: Thu, 4 Jun 2026 14:44:52 +0100 Subject: [PATCH] Add test for disabling syntax version checks in .pyi files Follow-up to #21539. --- test-data/unit/pythoneval.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test-data/unit/pythoneval.test b/test-data/unit/pythoneval.test index 399003f02c7fb..8c37e48d7c332 100644 --- a/test-data/unit/pythoneval.test +++ b/test-data/unit/pythoneval.test @@ -2298,3 +2298,15 @@ g((1, 2)) [out] _testNativeParserStarUnpackRequiresPython311.py:5: error: Star unpack syntax: requires Python 3.11 or newer (current target: Python 3.10) _testNativeParserStarUnpackRequiresPython311.py:6: note: Revealed type is "def [Ts] (x: tuple[*Ts])" + +[case testNativeParserPEP695InStubNoVersionError] +# flags: --python-version=3.11 --native-parser --ignore-missing-imports +import m +reveal_type(m.f) +[file m.pyi] +class C[T]: ... +def f[T](x: T) -> T: ... +type Alias[T] = list[T] +def g[T = int](x: T) -> T: ... +[out] +_testNativeParserPEP695InStubNoVersionError.py:3: note: Revealed type is "def [T] (x: T) -> T"