diff configmix/_speedups.c @ 710:ff0de14493f1

Test that "," is preferred over "|"
author Franz Glasner <f.glasner@feldmann-mg.com>
date Tue, 15 Aug 2023 14:31:46 +0200
parents e692216f8756
children c17a4e30ebbf
line wrap: on
line diff
--- a/configmix/_speedups.c	Tue Aug 15 11:40:18 2023 +0200
+++ b/configmix/_speedups.c	Tue Aug 15 14:31:46 2023 +0200
@@ -613,6 +613,7 @@
     Py_ssize_t sep;
     PyObject *res = NULL;
     PyObject *filters = NULL;
+    Py_ssize_t filters_len;
     PyObject *name = NULL;
     PyObject *tmp;
 
@@ -657,7 +658,11 @@
     }
     py_transfer_owned(&filters, &tmp);
 
-    if (PyObject_Not(filters)) {
+    filters_len = PyUnicode_GetLength(filters);
+    if (filters_len < 0) {
+        goto error;
+    }
+    if (filters_len == 0) {
         py_clear_ref(&filters);
 
         res = PyTuple_New(2);
@@ -684,7 +689,7 @@
     }
 
     if (direction == 1) {
-        if (PySequence_Contains(filters, sstate->FILTER_SEPARATOR_2)) {
+        if (PyUnicode_FindChar(filters, ',', 0, filters_len, 1) >= 0) {
             tmp = PyUnicode_Split(filters, sstate->FILTER_SEPARATOR_2, -1);
         }
         else {