From: Mark Wooding Date: Wed, 27 Nov 2019 15:12:23 +0000 (+0000) Subject: Merge branch '1.3.x' X-Git-Url: https://git.distorted.org.uk/~mdw/pyke/commitdiff_plain/d920a806df51ec41ffef2f8fb66a54235c2506eb?hp=8963e6870299fa42fe81f2b6acc3fcddf2058a9b Merge branch '1.3.x' * 1.3.x: (101 commits) rand.c: Show keyword argument as optional. mp.c: Fix punctuation error in docstrings. t/t-*.py: Use the `WriteBuffer.contents' property. t/t-bytes.py: Check that indexing, slicing, etc. return `C.ByteString'. t/t-algorithms.py: Add a simple test for `Keccak1600.copy'. t/t-algorithms.py: Add tests for other HSalsa20 and HChaCha key sizes. t/t-algorithms.py: Add AEAD tests. t/t-algorithms.py: Add tests for the new `KeySZ.pad' method. catacomb/__init__.py (KeySZRange.pad): Return correct value. algorithms.c: Propagate `AEADF_NOAAD' to `aad' objects. algorithms.c (AEADAAD.copy): Propagate the hashed length to the copy. 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. ... --- diff --git a/catacomb-python.h b/catacomb-python.h index 6c1ae21..bf3d426 100644 --- a/catacomb-python.h +++ b/catacomb-python.h @@ -120,6 +120,21 @@ #include #include +/*----- Other preliminaries -----------------------------------------------*/ + +#define GOBBLE_SEMI extern int notexist +#if defined(__GNUC__) && defined(__ELF__) +# define PRIVATE_SYMBOLS _Pragma("GCC visibility push(hidden)") GOBBLE_SEMI +# define PUBLIC_SYMBOLS _Pragma("GCC visibility pop") GOBBLE_SEMI +# define EXPORT __attribute__((__visibility__("default"))) +#else +# define PRIVATE_SYMBOLS GOBBLE_SEMI +# define PUBLIC_SYMBOLS GOBBLE_SEMI +# define EXPORT +#endif + +PRIVATE_SYMBOLS; + /*----- Utility macros ----------------------------------------------------*/ #define RETURN_OBJ(obj) do { Py_INCREF(obj); return (obj); } while (0) diff --git a/catacomb.c b/catacomb.c index e9c9513..e868f0f 100644 --- a/catacomb.c +++ b/catacomb.c @@ -144,7 +144,7 @@ static PyObject *meth__ego(PyObject *me, PyObject *arg) char *argv0; if (!PyArg_ParseTuple(arg, "s:_ego", &argv0)) return (0); - if (strcmp(QUIS, "") == 0) + if (STRCMP(QUIS, ==, "")) ego(argv0); RETURN_NONE; } @@ -164,14 +164,14 @@ static void init_random(void) if (!Py_HashRandomizationFlag) return; seed = getenv("PYTHONHASHSEED"); - if (!seed || strcmp(seed, "random") == 0) r = GR_WORD(&rand_global); + if (!seed || STRCMP(seed, ==, "random")) r = GR_WORD(&rand_global); else r = strtoul(seed, 0, 0); if (!r) r = 0xe011f220; /* zero doesn't work well */ unihash_setkey(&unihash_global, r); #endif } -void init_base(void) +EXPORT void init_base(void) { PyObject *mod; addmethods(methods);