Mercurial > hgrepos > Python > libs > ConfigMix
diff configmix/_speedups.c @ 602:a2fff0d93d83
Split up fast_pathstr2path into internal implementation and a simple wrapper
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Tue, 11 Jan 2022 00:52:56 +0100 |
| parents | 1e7e06ff970a |
| children | e55a42144ba9 |
line wrap: on
line diff
--- a/configmix/_speedups.c Tue Jan 11 00:45:33 2022 +0100 +++ b/configmix/_speedups.c Tue Jan 11 00:52:56 2022 +0100 @@ -465,7 +465,7 @@ static PyObject * -fast_pathstr2path(PyObject *self, PyObject *varname) +_fast_pathstr2path(PyObject *varname, PyObject *self, struct speedups_state *sstate) { Py_ssize_t varname_len; PyObject *parts = NULL; @@ -474,7 +474,6 @@ Py_ssize_t i; PyObject *o; PyObject *u; - struct speedups_state *sstate; varname_len = PyUnicode_GetLength(varname); if (varname_len < 0) { @@ -484,10 +483,12 @@ return PyTuple_New(0); } - sstate = PyModule_GetState(self); if (sstate == NULL) { - PyErr_SetString(PyExc_RuntimeError, "no module state available"); - return NULL; + sstate = PyModule_GetState(self); + if (sstate == NULL) { + PyErr_SetString(PyExc_RuntimeError, "no module state available"); + return NULL; + } } parts = PyUnicode_Split(varname, sstate->DOT, -1); if (parts == NULL) { @@ -522,6 +523,14 @@ static PyObject * +fast_pathstr2path(PyObject *self, PyObject *varname) +{ + return _fast_pathstr2path(varname, self, NULL); +} + + +static +PyObject * _fast_split_filters(PyObject *varname, PyObject *self, struct speedups_state *sstate) { Py_ssize_t varname_len;
