mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
[3.13] gh-131031: Fix test_pickle when invoked directly (GH-133356) (GH-133675)
(cherry picked from commit e15bbfafbc
)
This commit is contained in:
parent
fabe89b078
commit
8e334f40b8
1 changed files with 9 additions and 3 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue