Skip to content

Commit a29aa76

Browse files
authored
gh-92064: Fix global variable name collision in test_typing (#92067)
Fixes #92064
1 parent 2f7952c commit a29aa76

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

Lib/test/test_typing.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,36 +1332,36 @@ class TypeVarTuplePicklingTests(BaseTestCase):
13321332

13331333
@all_pickle_protocols
13341334
def test_pickling_then_unpickling_results_in_same_identity(self, proto):
1335-
global Ts1 # See explanation at start of class.
1336-
Ts1 = TypeVarTuple('Ts1')
1337-
Ts2 = pickle.loads(pickle.dumps(Ts1, proto))
1338-
self.assertIs(Ts1, Ts2)
1335+
global global_Ts1 # See explanation at start of class.
1336+
global_Ts1 = TypeVarTuple('global_Ts1')
1337+
global_Ts2 = pickle.loads(pickle.dumps(global_Ts1, proto))
1338+
self.assertIs(global_Ts1, global_Ts2)
13391339

13401340
@all_pickle_protocols
13411341
def test_pickling_then_unpickling_unpacked_results_in_same_identity(self, proto):
1342-
global Ts # See explanation at start of class.
1343-
Ts = TypeVarTuple('Ts')
1344-
unpacked1 = Unpack[Ts]
1342+
global global_Ts # See explanation at start of class.
1343+
global_Ts = TypeVarTuple('global_Ts')
1344+
unpacked1 = Unpack[global_Ts]
13451345
unpacked2 = pickle.loads(pickle.dumps(unpacked1, proto))
13461346
self.assertIs(unpacked1, unpacked2)
13471347

13481348
@all_pickle_protocols
13491349
def test_pickling_then_unpickling_tuple_with_typevartuple_equality(
13501350
self, proto
13511351
):
1352-
global T, Ts # See explanation at start of class.
1353-
T = TypeVar('T')
1354-
Ts = TypeVarTuple('Ts')
1352+
global global_T, global_Ts # See explanation at start of class.
1353+
global_T = TypeVar('global_T')
1354+
global_Ts = TypeVarTuple('global_Ts')
13551355

1356-
a1 = Tuple[Unpack[Ts]]
1356+
a1 = Tuple[Unpack[global_Ts]]
13571357
a2 = pickle.loads(pickle.dumps(a1, proto))
13581358
self.assertEqual(a1, a2)
13591359

1360-
a1 = Tuple[T, Unpack[Ts]]
1360+
a1 = Tuple[T, Unpack[global_Ts]]
13611361
a2 = pickle.loads(pickle.dumps(a1, proto))
13621362
self.assertEqual(a1, a2)
13631363

1364-
a1 = Tuple[int, Unpack[Ts]]
1364+
a1 = Tuple[int, Unpack[global_Ts]]
13651365
a2 = pickle.loads(pickle.dumps(a1, proto))
13661366
self.assertEqual(a1, a2)
13671367

0 commit comments

Comments
 (0)