diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2021-01-14 16:54:46 +0000 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2021-01-14 16:54:46 +0000 |
| commit | 6bcbfdf3eb0ba01dafb664a31348da93cdbf69e9 (patch) | |
| tree | aa334524a6e855788260b8cd3310cb1c281620fd | |
| parent | Update setup.py (diff) | |
| download | SyncRNG-6bcbfdf3eb0ba01dafb664a31348da93cdbf69e9.tar.gz SyncRNG-6bcbfdf3eb0ba01dafb664a31348da93cdbf69e9.zip | |
Use underscore in C module name
| -rw-r--r-- | SyncRNG/__init__.py | 3 | ||||
| -rw-r--r-- | src/_syncrng.c | 16 |
2 files changed, 10 insertions, 9 deletions
diff --git a/SyncRNG/__init__.py b/SyncRNG/__init__.py index 0ab4c06..e7e0b3b 100644 --- a/SyncRNG/__init__.py +++ b/SyncRNG/__init__.py @@ -9,7 +9,8 @@ from __future__ import division from copy import deepcopy from warnings import warn as _warn -import syncrng +from _syncrng import seed as _seed +from _syncrng import rand as _rand class SyncRNG(object): diff --git a/src/_syncrng.c b/src/_syncrng.c index 3cc77fa..5aaa177 100644 --- a/src/_syncrng.c +++ b/src/_syncrng.c @@ -117,7 +117,7 @@ void lfsr113_seed(uint32_t seed, uint64_t **state) * */ -static PyObject *syncrng_seed(PyObject *self, PyObject *args) +static PyObject *_syncrng_seed(PyObject *self, PyObject *args) { uint32_t seed; uint64_t *state = NULL; @@ -133,7 +133,7 @@ static PyObject *syncrng_seed(PyObject *self, PyObject *args) return pystate; } -static PyObject *syncrng_rand(PyObject *self, PyObject *args) +static PyObject *_syncrng_rand(PyObject *self, PyObject *args) { uint32_t i, value, numints; uint64_t *localstate; @@ -164,9 +164,9 @@ static PyObject *syncrng_rand(PyObject *self, PyObject *args) } static PyMethodDef SyncRNGMethods[] = { - {"seed", syncrng_seed, METH_VARARGS, + {"seed", _syncrng_seed, METH_VARARGS, "Seed the RNG."}, - {"rand", syncrng_rand, METH_VARARGS, + {"rand", _syncrng_rand, METH_VARARGS, "Generate a single random integer using SyncRNG."}, {NULL, NULL, 0, NULL} }; @@ -174,7 +174,7 @@ static PyMethodDef SyncRNGMethods[] = { #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, - "syncrng", + "_syncrng", "Python interface to SyncRNG", -1, SyncRNGMethods, @@ -194,7 +194,7 @@ moduleinit(void) #if PY_MAJOR_VERSION >= 3 m = PyModule_Create(&moduledef); #else - m = Py_InitModule3("syncrng", SyncRNGMethods, + m = Py_InitModule3("_syncrng", SyncRNGMethods, "Python interface to SyncRNG"); #endif @@ -203,13 +203,13 @@ moduleinit(void) #if PY_MAJOR_VERSION >= 3 PyMODINIT_FUNC -PyInit_syncrng(void) +PyInit__syncrng(void) { return moduleinit(); } #else PyMODINIT_FUNC -initsyncrng(void) +init_syncrng(void) { moduleinit(); } |
