https://github.com/python/cpython/commit/8e334f40b85b6fca564ce264c35ffb49e15520ba
commit: 8e334f40b85b6fca564ce264c35ffb49e15520ba
branch: 3.13
author: Serhiy Storchaka <storch...@gmail.com>
committer: serhiy-storchaka <storch...@gmail.com>
date: 2025-05-08T15:23:54Z
summary:

[3.13] gh-131031: Fix test_pickle when invoked directly (GH-133356) (GH-133675)

(cherry picked from commit e15bbfafbcc9153fa0b05beb806984e288fdefe4)

files:
M Lib/test/pickletester.py

diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index d9fdb2fdd5ad9f..0cd236ab249b1e 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -1968,7 +1968,11 @@ def test_nonencodable_module_name_error(self):
 
     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 @@ def test_nested_lookup_error(self):
 
     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):

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to