Skip to content

Commit 08b5cc3

Browse files
authored
fix: Typo when setting the state for the pickle deserializer. (#1479)
* fix: Typo when setting the state for the pickle deserializer.
1 parent 32ed601 commit 08b5cc3

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

google/auth/_refresh_worker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def __getstate__(self):
7575

7676
def __setstate__(self, state):
7777
"""Pickle helper that deserializes the _lock attribute."""
78-
state["_key"] = threading.Lock()
78+
state["_lock"] = threading.Lock()
7979
self.__dict__.update(state)
8080

8181

system_tests/secrets.tar.enc

-1 Bytes
Binary file not shown.

tests/test__refresh_worker.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ def test_refresh_dead_worker():
150150

151151
def test_pickle():
152152
w = _refresh_worker.RefreshThreadManager()
153+
# For some reason isinstance cannot interpret threading.Lock as a type.
154+
assert w._lock is not None
153155

154156
pickled_manager = pickle.dumps(w)
155157
manager = pickle.loads(pickled_manager)
156158
assert isinstance(manager, _refresh_worker.RefreshThreadManager)
159+
assert manager._lock is not None

0 commit comments

Comments
 (0)