# HG changeset patch # User Franz Glasner # Date 1641858776 -3600 # Node ID a2fff0d93d83e9ed033f39f45c7956ce746eb4e2 # Parent 1e7e06ff970a983269ff416237dbb39bf76e3575 Split up fast_pathstr2path into internal implementation and a simple wrapper diff -r 1e7e06ff970a -r a2fff0d93d83 configmix/_speedups.c --- 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;