Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pickle version for python_memcache_serializer adjustable #190

Merged
merged 2 commits into from
Sep 12, 2018

Conversation

jogo
Copy link
Contributor

@jogo jogo commented Sep 7, 2018

It's unsafe to use the max pickle version when you are switching between
versions of python with different max versions.

Add a new function get_python_memcache_serializer_pickle_version that
returns a python_memcache_serializer with any pickle version.

@jogo jogo requested a review from jparise September 7, 2018 21:56
pymemcache/test/test_serde.py Show resolved Hide resolved
pickler.dump(value)
value = output.getvalue()

return value, flags


def get_python_memcache_serializer_pickle_version(pickle_version=None):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be shortened to get_python_memcache_serializer(), in case there are other reasonable parameters to provide in the future. That will keep the public API more stable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, I am bad at naming things.



python_memcache_serializer = partial(
_python_memcache_serializer, pickle_version=DEFAULT_PICKLE_VERSION)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could just call get_python_memcache_serializer.

Copy link
Collaborator

@jparise jparise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, the new get_python_memcache_serializer should be explained in the documentation.

It's unsafe to use the max pickle version when you are switching between
versions of python with different max versions.

Add a new function get_python_memcache_serializer that
returns a python_memcache_serializer with any pickle version.
@jogo
Copy link
Contributor Author

jogo commented Sep 12, 2018

added a few lines to getting_started to cover the serde module

docs/getting_started.rst Outdated Show resolved Hide resolved
docs/getting_started.rst Outdated Show resolved Hide resolved
@jogo jogo merged commit 7d56284 into pinterest:master Sep 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants