gh-126209: Fix inconsistency of skip_file_prefixes in warnings.warn's C and Python implementations (GH-126329)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
This commit is contained in:
Daehee Kim 2024-11-12 21:01:56 +09:00 committed by GitHub
parent f223efb2a2
commit 0ef84b0e2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 23 additions and 5 deletions

View file

@ -803,7 +803,8 @@ is_filename_to_skip(PyObject *filename, PyTupleObject *skip_file_prefixes)
for (Py_ssize_t idx = 0; idx < prefixes; ++idx)
{
PyObject *prefix = PyTuple_GET_ITEM(skip_file_prefixes, idx);
Py_ssize_t found = PyUnicode_Tailmatch(filename, prefix, 0, -1, -1);
Py_ssize_t found = PyUnicode_Tailmatch(filename, prefix,
0, PY_SSIZE_T_MAX, -1);
if (found == 1) {
return true;
}