8000 [3.13] gh-131031: Fix test_pickle when invoked directly (GH-133356) (… · python/cpython@8e334f4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8e334f4

Browse files
[3.13] gh-131031: Fix test_pickle when invoked directly (GH-133356) (GH-133675)
(cherry picked from commit e15bbfa)
1 parent fabe89b commit 8e334f4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Lib/test/pickletester.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,7 +1968,11 @@ def test_nonencodable_module_name_error(self):
19681968

19691969
def test_nested_lookup_error(self):
19701970
# Nested name does not exist
1971-
obj = REX('AbstractPickleTests.spam')
1971+
global TestGlobal
1972+
class TestGlobal:
1973+
class A:
1974+
pass
1975+
obj = REX('TestGlobal.A.B.C')
19721976
obj.__module__ = __name__
19731977
for proto in protocols:
19741978
with self.subTest(proto=proto):
@@ -1983,9 +1987,11 @@ def test_nested_lookup_error(self):
19831987

19841988
def test_wrong_object_lookup_error(self):
19851989
# Name is bound to different object
1986-
obj = REX('AbstractPickleTests')
1990+
global TestGlobal
1991+
class TestGlobal:
1992+
pass
1993+
obj = REX('TestGlobal')
19871994
obj.__module__ = __name__
1988-
AbstractPickleTests.ham = []
19891995
for proto in protocols:
19901996
with self.subTest(proto=proto):
19911997
with self.assertRaises(pickle.PicklingError):

0 commit comments

Comments
 (0)
0