diff options
author | Dwayne Litzenberger <dlitz@dlitz.net> | 2013-07-14 10:55:06 -0700 |
---|---|---|
committer | Dwayne Litzenberger <dlitz@dlitz.net> | 2013-07-14 18:32:04 -0700 |
commit | b6ad2b47d9b7f3799c29097b4324dff2540fe77d (patch) | |
tree | add26f4b539dadecb45f21e265f04c827db195db /src/_counter.c | |
parent | 0ee73a1b571f540cfca8d656853f2bc3df2e3767 (diff) | |
download | pycrypto-b6ad2b47d9b7f3799c29097b4324dff2540fe77d.tar.gz |
Counter: Deprecate disable_shortcut; Remove __PCT_CTR_SHORTCUT__ entirely
The `disable_shortcut` option served as a workaround in case
`__PCT_CTR_SHORTCUT__` leaked through a wrapper object, but I don't
think anyone actually used it, and it was a bad idea to expose it as
part of the public API.
Now that we do strong type checking inside block_template.c, there
shoujld be no need to ever use this option. It's now a no-op, retained
for backward compatibility only. It will be removed in some future
version of PyCrypto.
Diffstat (limited to 'src/_counter.c')
-rw-r--r-- | src/_counter.c | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/src/_counter.c b/src/_counter.c index c1f1e5f..729fc9e 100644 --- a/src/_counter.c +++ b/src/_counter.c @@ -42,11 +42,10 @@ CounterObject_init(PCT_CounterObject *self, PyObject *args, PyObject *kwargs) PyStringObject *prefix=NULL, *suffix=NULL, *initval=NULL; #endif int allow_wraparound = 0; - int disable_shortcut = 0; Py_ssize_t size; - static char *kwlist[] = {"prefix", "suffix", "initval", "allow_wraparound", "disable_shortcut", NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "SSS|ii", kwlist, &prefix, &suffix, &initval, &allow_wraparound, &disable_shortcut)) + static char *kwlist[] = {"prefix", "suffix", "initval", "allow_wraparound", NULL}; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "SSS|i", kwlist, &prefix, &suffix, &initval, &allow_wraparound)) return -1; /* Check string size and set nbytes */ @@ -115,8 +114,7 @@ CounterObject_init(PCT_CounterObject *self, PyObject *args, PyObject *kwargs) memcpy(self->p, PyBytes_AS_STRING(initval), self->nbytes); memcpy(self->p + self->nbytes, PyBytes_AS_STRING(suffix), PyBytes_GET_SIZE(suffix)); - /* Set shortcut_disabled and allow_wraparound */ - self->shortcut_disabled = disable_shortcut; + /* Set allow_wraparound */ self->allow_wraparound = allow_wraparound; /* Clear the carry flag */ @@ -322,14 +320,6 @@ CounterLEObject_getattr(PyObject *s, char *name) if (strcmp(name, "carry") == 0) { #endif return PyLong_FromLong((long)self->carry); -#ifdef IS_PY3K - } else if (!self->shortcut_disabled && PyUnicode_CompareWithASCIIString(attr, "__PCT_CTR_SHORTCUT__") == 0) { -#else - } else if (!self->shortcut_disabled && strcmp(name, "__PCT_CTR_SHORTCUT__") == 0) { -#endif - /* Shortcut hack - See block_template.c */ - Py_INCREF(Py_True); - return Py_True; } #ifdef IS_PY3K generic: @@ -356,14 +346,6 @@ CounterBEObject_getattr(PyObject *s, char *name) if (strcmp(name, "carry") == 0) { #endif return PyLong_FromLong((long)self->carry); -#ifdef IS_PY3K - } else if (!self->shortcut_disabled && PyUnicode_CompareWithASCIIString(attr, "__PCT_CTR_SHORTCUT__") == 0) { -#else - } else if (!self->shortcut_disabled && strcmp(name, "__PCT_CTR_SHORTCUT__") == 0) { -#endif - /* Shortcut hack - See block_template.c */ - Py_INCREF(Py_True); - return Py_True; } #ifdef IS_PY3K generic: |