comparison 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
comparison
equal deleted inserted replaced
709:115de6fe420e 710:ff0de14493f1
611 { 611 {
612 Py_ssize_t varname_len; 612 Py_ssize_t varname_len;
613 Py_ssize_t sep; 613 Py_ssize_t sep;
614 PyObject *res = NULL; 614 PyObject *res = NULL;
615 PyObject *filters = NULL; 615 PyObject *filters = NULL;
616 Py_ssize_t filters_len;
616 PyObject *name = NULL; 617 PyObject *name = NULL;
617 PyObject *tmp; 618 PyObject *tmp;
618 619
619 varname_len = PyUnicode_GetLength(varname); 620 varname_len = PyUnicode_GetLength(varname);
620 if (varname_len < 0) { 621 if (varname_len < 0) {
655 if (tmp == NULL) { 656 if (tmp == NULL) {
656 goto error; 657 goto error;
657 } 658 }
658 py_transfer_owned(&filters, &tmp); 659 py_transfer_owned(&filters, &tmp);
659 660
660 if (PyObject_Not(filters)) { 661 filters_len = PyUnicode_GetLength(filters);
662 if (filters_len < 0) {
663 goto error;
664 }
665 if (filters_len == 0) {
661 py_clear_ref(&filters); 666 py_clear_ref(&filters);
662 667
663 res = PyTuple_New(2); 668 res = PyTuple_New(2);
664 if (res == NULL) { 669 if (res == NULL) {
665 goto error; 670 goto error;
682 goto error; 687 goto error;
683 } 688 }
684 } 689 }
685 690
686 if (direction == 1) { 691 if (direction == 1) {
687 if (PySequence_Contains(filters, sstate->FILTER_SEPARATOR_2)) { 692 if (PyUnicode_FindChar(filters, ',', 0, filters_len, 1) >= 0) {
688 tmp = PyUnicode_Split(filters, sstate->FILTER_SEPARATOR_2, -1); 693 tmp = PyUnicode_Split(filters, sstate->FILTER_SEPARATOR_2, -1);
689 } 694 }
690 else { 695 else {
691 tmp = PyUnicode_Split(filters, sstate->FILTER_SEPARATOR, -1); 696 tmp = PyUnicode_Split(filters, sstate->FILTER_SEPARATOR, -1);
692 } 697 }