Skip to content

Commit

Permalink
fix: Typo when setting the state for the pickle deserializer. (#1479)
Browse files Browse the repository at this point in the history
* fix: Typo when setting the state for the pickle deserializer.
  • Loading branch information
clundin25 authored Feb 21, 2024
1 parent 32ed601 commit 08b5cc3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion google/auth/_refresh_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def __getstate__(self):

def __setstate__(self, state):
"""Pickle helper that deserializes the _lock attribute."""
state["_key"] = threading.Lock()
state["_lock"] = threading.Lock()
self.__dict__.update(state)


Expand Down
Binary file modified system_tests/secrets.tar.enc
Binary file not shown.
3 changes: 3 additions & 0 deletions tests/test__refresh_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ def test_refresh_dead_worker():

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

pickled_manager = pickle.dumps(w)
manager = pickle.loads(pickled_manager)
assert isinstance(manager, _refresh_worker.RefreshThreadManager)
assert manager._lock is not None

0 comments on commit 08b5cc3

Please sign in to comment.