Skip to content

Commit

Permalink
Make clients explicitly unpickleable.
Browse files Browse the repository at this point in the history
Closes #3211.
  • Loading branch information
Luke Sneeringer authored and dhermes committed Mar 30, 2017
1 parent 42bf2e6 commit 1c7098d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/google/cloud/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ def __getstate__(self):
'Clients have non-trivial state that is local and unpickleable.',
]))

def __getstate__(self):
"""Explicitly state that clients are not pickleable."""

raise PicklingError('\n'.join([
'Pickling client objects is explicitly not supported.',
'Clients have non-trivial state that is local and unpickleable.',
]))

@property
def _http(self):
"""Getter for object used for HTTP transport.
Expand Down

0 comments on commit 1c7098d

Please sign in to comment.