Commit c9a1626
committed
Fixed return value from delete command.
The `delete()` command currently returns `1` if the response from the
server is either `'DELETED'` or `'NOT_FOUND'`. This differs from other
implementations, e.g. `pymemcache` and `pylibmc`, and doesn't seem to
make sense given that these are the only two documented return types
from the protocol for the delete command.
It seems that `delete()` was changed to explicitly consider both
responses as successful way back in 2010, but that change only seemed to
double down on the behavior that was being reported in the issue.
See https://bugs.launchpad.net/python-memcached/+bug/471727. The concern
was avoiding breaking backward compatibility.
It was possible to work around this by calling `_deletetouch()` and
passing in the `expected` responses, but that was broken by the change
to remove `time` in ab668ed.
Making the change to interpret `'NOT_FOUND'` as `0` doesn't cause any
test failures, is consistent with the docstring which states that that
the command returns non-zero on success, and also brings consistency
with other implementations.
Fixes #170.1 parent deac889 commit c9a1626
2 files changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
552 | 552 | | |
553 | 553 | | |
554 | 554 | | |
555 | | - | |
| 555 | + | |
556 | 556 | | |
557 | | - | |
| 557 | + | |
558 | 558 | | |
559 | 559 | | |
560 | 560 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
| |||
0 commit comments