From: Mark Wooding Date: Wed, 27 Nov 2019 15:11:08 +0000 (+0000) Subject: Merge branch '1.2.x' into 1.3.x X-Git-Url: https://git.distorted.org.uk/~mdw/pyke/commitdiff_plain/8963e6870299fa42fe81f2b6acc3fcddf2058a9b Merge branch '1.2.x' into 1.3.x * 1.2.x: (89 commits) t/: Add a test suite. ec.c: Don't lose error status when constructing points from a sequence. ec.c: Free partially constructed points coordinatewise. *.c: Be more careful about `PySequence_Size'. key.c: Reformat the rest of the `KeyError' constructor. key.c: Parse `KeyError' constructor arguments by hand. catacomb-python.h: Add a macro for raising `OverflowError'. key.c: Collect `KeyError' argument count as a separate step. key.c: Use tuple functions on `KeyError' argument tuple. key.c: Rename sad-path label to `end'. key.c: Delete duplicate setting of `errstring'. util.c (mkexc): Populate dictionary before constructing exception class. key.c: Only set the error code. catacomb.c, util.c: Publish negative constants correctly. field.c: Delete the completely unused `getfe' function. key.c (convfilter): Fix sense of error tests. buffer.c, ec.c: Fix required size for EC `buffer' encoding. algorithms.c: Fix `max' property name in docstrings. catacomb/__init__.py (_HashBase): Check that integers are within bounds. debian/rules: Build using the provided Makefile. ... --- 8963e6870299fa42fe81f2b6acc3fcddf2058a9b diff --cc catacomb-python.h index df29099,ad27461..6c1ae21 --- a/catacomb-python.h +++ b/catacomb-python.h @@@ -134,8 -133,8 +134,9 @@@ goto end; \ } while (0) #define VALERR(str) EXCERR(PyExc_ValueError, str) + #define OVFERR(str) EXCERR(PyExc_OverflowError, str) #define TYERR(str) EXCERR(PyExc_TypeError, str) +#define IXERR(str) EXCERR(PyExc_IndexError, str) #define ZDIVERR(str) EXCERR(PyExc_ZeroDivisionError, str) #define SYSERR(str) EXCERR(PyExc_SystemError, str) #define NIERR(str) EXCERR(PyExc_NotImplementedError, str) @@@ -233,9 -234,8 +236,10 @@@ MODULES(DO return (d); \ } +#define KWLIST (/*unconst*/ char **)kwlist + - struct nameval { const char *name; unsigned long value; }; + struct nameval { const char *name; unsigned f; unsigned long value; }; + #define CF_SIGNED 1u extern void setconstants(PyObject *, const struct nameval *); extern PyObject *mexp_common(PyObject *, PyObject *, size_t, diff --cc util.c index 2e6ee25,29f7d12..723c819 --- a/util.c +++ b/util.c @@@ -609,9 -743,7 +743,9 @@@ PyObject *gmapmeth_get(PyObject *me, Py { PyObject *k, *def = Py_None, *v; - if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO:get", - if (!PyArg_ParseTupleAndKeywords(arg, kw, "O|O:get", def_kwlist, &k, &def)) ++ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O|O:get", + (/*unconst*/ char **)def_kwlist, + &k, &def)) return (0); if ((v = PyObject_GetItem(me, k)) != 0) return (v); PyErr_Clear(); @@@ -622,9 -754,8 +756,9 @@@ PyObject *gmapmeth_setdefault(PyObject { PyObject *k, *def = Py_None, *v; - if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO:setdefault", + if (!PyArg_ParseTupleAndKeywords(arg, kw, "O|O:setdefault", - def_kwlist, &k, &def)) + (/*unconst*/ char **)def_kwlist, + &k, &def)) return (0); if ((v = PyObject_GetItem(me, k)) != 0) return (v); PyErr_Clear(); @@@ -636,9 -767,7 +770,9 @@@ PyObject *gmapmeth_pop(PyObject *me, Py { PyObject *k, *def = 0, *v; - if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO:pop", - if (!PyArg_ParseTupleAndKeywords(arg, kw, "O|O:pop", def_kwlist, &k, &def)) ++ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O|O:pop", + (/*unconst*/ char **)def_kwlist, + &k, &def)) return (0); if ((v = PyObject_GetItem(me, k)) != 0) { PyObject_DelItem(me, k);