]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-131031: Fix test_pickle when invoked directly (GH-133356) (GH-133675)
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 8 May 2025 15:23:54 +0000 (18:23 +0300)
committerGitHub <noreply@github.com>
Thu, 8 May 2025 15:23:54 +0000 (15:23 +0000)
(cherry picked from commit e15bbfafbcc9153fa0b05beb806984e288fdefe4)

Lib/test/pickletester.py

index d9fdb2fdd5ad9fec3b9562b2dc91be04bd99790b..0cd236ab249b1e94c88fdb42c3c846c74cf5dbb5 100644 (file)
@@ -1968,7 +1968,11 @@ class AbstractPicklingErrorTests:
 
     def test_nested_lookup_error(self):
         # Nested name does not exist
-        obj = REX('AbstractPickleTests.spam')
+        global TestGlobal
+        class TestGlobal:
+            class A:
+                pass
+        obj = REX('TestGlobal.A.B.C')
         obj.__module__ = __name__
         for proto in protocols:
             with self.subTest(proto=proto):
@@ -1983,9 +1987,11 @@ class AbstractPicklingErrorTests:
 
     def test_wrong_object_lookup_error(self):
         # Name is bound to different object
-        obj = REX('AbstractPickleTests')
+        global TestGlobal
+        class TestGlobal:
+            pass
+        obj = REX('TestGlobal')
         obj.__module__ = __name__
-        AbstractPickleTests.ham = []
         for proto in protocols:
             with self.subTest(proto=proto):
                 with self.assertRaises(pickle.PicklingError):