<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/python-packages/pymemcache.git/pymemcache/test/test_integration.py, branch github-actions</title>
<subtitle>github.com: pinterest/pymemcache.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/pymemcache.git/'/>
<entry>
<title>Validate cas inputs as strings of digits (#250)</title>
<updated>2019-08-26T23:20:04+00:00</updated>
<author>
<name>Stephen Rosen</name>
<email>sirosen@globus.org</email>
</author>
<published>2019-08-26T23:20:04+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/pymemcache.git/commit/?id=d5dafc1490b26fc8109571bd30311c9b729ea8a5'/>
<id>d5dafc1490b26fc8109571bd30311c9b729ea8a5</id>
<content type='text'>
For consideration for v3.0.0

'cas' is documented as needing to be an int or bytestring of the digits
0-9. However, this is not actually enforced and it is possible to pass a
value to pymemcache which doesn't conform to these rules. In fact, you
can do weird things like `cas=b'noreply'` and potentially trigger
"unexpected" behavior.

To go along with validating int inputs, validate cas inputs. However,
these are not necessarily integers. Instead, if an int or string is
given, it will be encoded as a bytestring. But in order to validate the
value given, it is checked against isdigit() .

(NB: You could also use `int(cas)` for very similar checking.)

Rationale for allowing non-integer inputs to cas is not obvious.
Presumably it allows callers using `gets()` to pass the `cas` value they
get back into a `cas` command without issue. But it may be debatable.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For consideration for v3.0.0

'cas' is documented as needing to be an int or bytestring of the digits
0-9. However, this is not actually enforced and it is possible to pass a
value to pymemcache which doesn't conform to these rules. In fact, you
can do weird things like `cas=b'noreply'` and potentially trigger
"unexpected" behavior.

To go along with validating int inputs, validate cas inputs. However,
these are not necessarily integers. Instead, if an int or string is
given, it will be encoded as a bytestring. But in order to validate the
value given, it is checked against isdigit() .

(NB: You could also use `int(cas)` for very similar checking.)

Rationale for allowing non-integer inputs to cas is not obvious.
Presumably it allows callers using `gets()` to pass the `cas` value they
get back into a `cas` command without issue. But it may be debatable.</pre>
</div>
</content>
</entry>
<entry>
<title>Change serialization interface to be an object (#245)</title>
<updated>2019-08-26T18:11:31+00:00</updated>
<author>
<name>Stephen Rosen</name>
<email>sirosen@globus.org</email>
</author>
<published>2019-08-26T18:11:31+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/pymemcache.git/commit/?id=5699c9dfa7067a99000e281091dd6400a1e84122'/>
<id>5699c9dfa7067a99000e281091dd6400a1e84122</id>
<content type='text'>
* Change serialization interface to be an object

Rather than passing separate serialization and deserialization methods
to a pymemcache client, pass an object implementing a very simple
two-method interface.

This is a rather significant breaking change and should be part of an
x.0.0 major release.

Resolves #56

As suggested in that issue, this is a cleaner interface, as there's no
sensible context in which you would provide only one of these two
methods and it should therefore be thought of as a
serialization/deserialization protocol.

Also adds a note to the documentation's Best Practices list that you
should use the built-in serializer object unless you have a reason to do
otherwise.

* Support "de/serializer" in addition to "serde"

In order to support older client usage in addition to the new
serialization object (protocol), restore the "serializer" and
"deserializer" arguments to the Client classes.
These are marked as deprecated and will be automatically wrapped into a
small "serde" object.

In order to make the various object names more distinguishable and more
informative, the built-in default serializer is now called
"python_memcache_pickle_serde"

Additionally, default client.serde to a "no-op serializer".
This object does no transforms on the data. By putting this in place, we
can skip some conditionals in the code around presence or absence of a
serializer and therefore simplify internally (at the cost of an extra,
unnecessary, functional call in some cases).

It also simplifies logic around the handling of flags because we are now
*guaranteed* the presence of a serializer object which returns some
flags. i.e. "default flags" are no longer the responsibility of the
various serializer usage sites.
This is done carefully to ensure that passing a `serializer` without a
`deserializer` is respected.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Change serialization interface to be an object

Rather than passing separate serialization and deserialization methods
to a pymemcache client, pass an object implementing a very simple
two-method interface.

This is a rather significant breaking change and should be part of an
x.0.0 major release.

Resolves #56

As suggested in that issue, this is a cleaner interface, as there's no
sensible context in which you would provide only one of these two
methods and it should therefore be thought of as a
serialization/deserialization protocol.

Also adds a note to the documentation's Best Practices list that you
should use the built-in serializer object unless you have a reason to do
otherwise.

* Support "de/serializer" in addition to "serde"

In order to support older client usage in addition to the new
serialization object (protocol), restore the "serializer" and
"deserializer" arguments to the Client classes.
These are marked as deprecated and will be automatically wrapped into a
small "serde" object.

In order to make the various object names more distinguishable and more
informative, the built-in default serializer is now called
"python_memcache_pickle_serde"

Additionally, default client.serde to a "no-op serializer".
This object does no transforms on the data. By putting this in place, we
can skip some conditionals in the code around presence or absence of a
serializer and therefore simplify internally (at the cost of an extra,
unnecessary, functional call in some cases).

It also simplifies logic around the handling of flags because we are now
*guaranteed* the presence of a serializer object which returns some
flags. i.e. "default flags" are no longer the responsibility of the
various serializer usage sites.
This is done carefully to ensure that passing a `serializer` without a
`deserializer` is respected.</pre>
</div>
</content>
</entry>
<entry>
<title>Make pickle version for python_memcache_serializer adjustable</title>
<updated>2018-09-07T22:55:14+00:00</updated>
<author>
<name>Joe Gordon</name>
<email>jogo@pinterest.com</email>
</author>
<published>2018-09-07T21:52:43+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/pymemcache.git/commit/?id=c9b89dcef88cf94b22da7c9ad80b3212a15233b5'/>
<id>c9b89dcef88cf94b22da7c9ad80b3212a15233b5</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix support newbytes from future</title>
<updated>2018-09-07T00:38:30+00:00</updated>
<author>
<name>Joe Gordon</name>
<email>jogo@pinterest.com</email>
</author>
<published>2018-09-07T00:08:04+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/pymemcache.git/commit/?id=9ed0caa19ac3843c3449e2d4603bc0ec9327b2a1'/>
<id>9ed0caa19ac3843c3449e2d4603bc0ec9327b2a1</id>
<content type='text'>
Previously python2 code using python-future to backport the py3 bytes
behavior would trigger the following exception:

code:

  from builtins import bytes as newbytes
  from pymemcache.client.base import Client
  client = Client(('localhost', 11211))
  client.set(newbytes('key'), 'value')

  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/usr/local/lib/python2.7/site-packages/pymemcache/client/base.py", line 297, in set
      return self._store_cmd(b'set', key, expire, noreply, value)
    File "/usr/local/lib/python2.7/site-packages/pymemcache/client/base.py", line 770, in _store_cmd
      key = self.check_key(key)
    File "/usr/local/lib/python2.7/site-packages/pymemcache/client/base.py", line 251, in check_key
      key_prefix=self.key_prefix)
    File "/usr/local/lib/python2.7/site-packages/pymemcache/client/base.py", line 91, in _check_key
      key = key.encode('ascii')
    File "/usr/local/lib/python2.7/site-packages/future/types/newbytes.py", line 381, in __getattribute__
      raise AttributeError("encode method has been disabled in newbytes")
  AttributeError: encode method has been disabled in newbytes

Add a test case for this and fix.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously python2 code using python-future to backport the py3 bytes
behavior would trigger the following exception:

code:

  from builtins import bytes as newbytes
  from pymemcache.client.base import Client
  client = Client(('localhost', 11211))
  client.set(newbytes('key'), 'value')

  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/usr/local/lib/python2.7/site-packages/pymemcache/client/base.py", line 297, in set
      return self._store_cmd(b'set', key, expire, noreply, value)
    File "/usr/local/lib/python2.7/site-packages/pymemcache/client/base.py", line 770, in _store_cmd
      key = self.check_key(key)
    File "/usr/local/lib/python2.7/site-packages/pymemcache/client/base.py", line 251, in check_key
      key_prefix=self.key_prefix)
    File "/usr/local/lib/python2.7/site-packages/pymemcache/client/base.py", line 91, in _check_key
      key = key.encode('ascii')
    File "/usr/local/lib/python2.7/site-packages/future/types/newbytes.py", line 381, in __getattribute__
      raise AttributeError("encode method has been disabled in newbytes")
  AttributeError: encode method has been disabled in newbytes

Add a test case for this and fix.
</pre>
</div>
</content>
</entry>
<entry>
<title>Ensure serde integration tests return the same type</title>
<updated>2016-12-04T23:15:37+00:00</updated>
<author>
<name>Alex Tomkins</name>
<email>tomkins@darkzone.net</email>
</author>
<published>2016-11-23T00:00:31+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/pymemcache.git/commit/?id=164f4cf77329ae2a44d8a0c7005dc2b50e7683af'/>
<id>164f4cf77329ae2a44d8a0c7005dc2b50e7683af</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Add a few more serde integration tests</title>
<updated>2016-12-04T23:15:37+00:00</updated>
<author>
<name>Alex Tomkins</name>
<email>tomkins@darkzone.net</email>
</author>
<published>2016-11-22T23:39:20+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/pymemcache.git/commit/?id=346984ad51e74aafe0506f65cbef47d478ed4679'/>
<id>346984ad51e74aafe0506f65cbef47d478ed4679</id>
<content type='text'>
- A string (will vary on Python version)
- Another unicode string
- A list (pickled)
- A defaultdict (pickled)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- A string (will vary on Python version)
- Another unicode string
- A list (pickled)
- A defaultdict (pickled)
</pre>
</div>
</content>
</entry>
<entry>
<title>Add integration test for serde serialization</title>
<updated>2016-12-04T23:15:37+00:00</updated>
<author>
<name>Alex Tomkins</name>
<email>tomkins@darkzone.net</email>
</author>
<published>2016-11-13T16:11:28+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/pymemcache.git/commit/?id=7658ee0595a806f9d78b8b9e700dbcf646725a8d'/>
<id>7658ee0595a806f9d78b8b9e700dbcf646725a8d</id>
<content type='text'>
Currently this will fail with unicode strings on Python 3, as the pymemcache client will return a byte string - but the deserializer doesn't change it back to a unicode string.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently this will fail with unicode strings on Python 3, as the pymemcache client will return a byte string - but the deserializer doesn't change it back to a unicode string.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix syntax errors</title>
<updated>2016-11-05T18:11:02+00:00</updated>
<author>
<name>Nicholas Charriere</name>
<email>nicholas@pinterest.com</email>
</author>
<published>2016-11-05T18:11:02+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/pymemcache.git/commit/?id=197f41943764cdfb257164c9665bb159d58a9ba8'/>
<id>197f41943764cdfb257164c9665bb159d58a9ba8</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Add optional support for unicode keys</title>
<updated>2016-11-03T16:52:53+00:00</updated>
<author>
<name>Joe Gordon</name>
<email>jogo@pinterest.com</email>
</author>
<published>2016-10-31T21:04:00+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/pymemcache.git/commit/?id=3613587536673154b45dbb8fe482e736f13a3a36'/>
<id>3613587536673154b45dbb8fe482e736f13a3a36</id>
<content type='text'>
memcached's ASCII protocol supports unicode keys, so lets support them
as well. Since using unicode keys for memcache is uncommon and to
preserve the previous behavior disable support by default.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
memcached's ASCII protocol supports unicode keys, so lets support them
as well. Since using unicode keys for memcache is uncommon and to
preserve the previous behavior disable support by default.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix #99 unsanitized input</title>
<updated>2016-07-27T20:06:22+00:00</updated>
<author>
<name>Nicholas Charriere</name>
<email>nicholas@pinterest.com</email>
</author>
<published>2016-07-27T19:57:23+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/pymemcache.git/commit/?id=feec79d7385a529e1ef79675b8c4daa4078d7398'/>
<id>feec79d7385a529e1ef79675b8c4daa4078d7398</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
