[Python-checkins] gh-107909: Test explicit `object` base in PEP695 generic classes (#108001)

JelleZijlstra webhook-mailer at python.org
Wed Aug 16 09:30:07 EDT 2023


https://github.com/python/cpython/commit/b61f5995aebb93496e968ca8d307375fa86d9329
commit: b61f5995aebb93496e968ca8d307375fa86d9329
branch: main
author: Nikita Sobolev <mail at sobolevn.me>
committer: JelleZijlstra <jelle.zijlstra at gmail.com>
date: 2023-08-16T06:30:03-07:00
summary:

gh-107909: Test explicit `object` base in PEP695 generic classes (#108001)

files:
M Lib/test/test_type_params.py

diff --git a/Lib/test/test_type_params.py b/Lib/test/test_type_params.py
index bced641a9661f..0045057f181e1 100644
--- a/Lib/test/test_type_params.py
+++ b/Lib/test/test_type_params.py
@@ -148,6 +148,10 @@ def test_disallowed_expressions(self):
         check_syntax_error(self, "def f[T: [(x := 3) for _ in range(2)]](): pass")
         check_syntax_error(self, "type T = [(x := 3) for _ in range(2)]")
 
+    def test_incorrect_mro_explicit_object(self):
+        with self.assertRaisesRegex(TypeError, r"\(MRO\) for bases object, Generic"):
+            class My[X](object): ...
+
 
 class TypeParamsNonlocalTest(unittest.TestCase):
     def test_nonlocal_disallowed_01(self):



More information about the Python-checkins mailing list