# HG changeset patch # User Franz Glasner # Date 1641152604 -3600 # Node ID 9d2bd411f5c5ec476753eb69b39fdd245be7c1c1 # Parent 39e5d07d8dbc7e286130b18b1e7b384448c2f4c4 Do not rstrip() the remaining variable name when parsing out filters from variable names diff -r 39e5d07d8dbc -r 9d2bd411f5c5 configmix/_speedups.c --- a/configmix/_speedups.c Sun Jan 02 20:40:09 2022 +0100 +++ b/configmix/_speedups.c Sun Jan 02 20:43:24 2022 +0100 @@ -559,12 +559,6 @@ if (name == NULL) { goto error; } - tmp = PyObject_CallMethod(name, "rstrip", NULL); - if (tmp == NULL) { - goto error; - } - Py_DECREF(name); - name = tmp; filters = PyUnicode_Substring(varname, sep+1, varname_len); if (filters == NULL) { diff -r 39e5d07d8dbc -r 9d2bd411f5c5 configmix/config.py --- a/configmix/config.py Sun Jan 02 20:40:09 2022 +0100 +++ b/configmix/config.py Sun Jan 02 20:43:24 2022 +0100 @@ -411,10 +411,9 @@ if sep: filters = filters.strip() if filters: - return (name.rstrip(), - filters.split(_FILTER_SEPARATOR)) + return (name, filters.split(_FILTER_SEPARATOR)) else: - return (name.rstrip(), []) + return (name, []) else: return (name, []) diff -r 39e5d07d8dbc -r 9d2bd411f5c5 tests/test.py --- a/tests/test.py Sun Jan 02 20:40:09 2022 +0100 +++ b/tests/test.py Sun Jan 02 20:43:24 2022 +0100 @@ -1906,20 +1906,20 @@ def test_split_filters_empty(self): self.assertEqual((u"", []), self.split_filters(u"")) - def test_split_filters_varname_only(self): - self.assertEqual((u"varname ", []), self.split_filters(u"varname ")) + def test_split_filters_varname_only_no_stripping(self): + self.assertEqual((u" varname ", []), self.split_filters(u" varname ")) - def test_split_filters_single_stripping(self): - self.assertEqual((u" the-varname", []), + def test_split_filters_single_no_stripping(self): + self.assertEqual((u" the-varname ", []), self.split_filters(u" the-varname | ")) def test_split_filters_one(self): self.assertEqual((u"the-varname", [u"None"]), - self.split_filters(u"the-varname |None")) + self.split_filters(u"the-varname|None")) def test_split_filters_many(self): self.assertEqual((u"the-varname", [u"Empty", u"None"]), - self.split_filters(u"the-varname |Empty|None")) + self.split_filters(u"the-varname|Empty|None")) class T09Parser(_TParserMixin, unittest.TestCase):