test_str: the UCS4 adaptive search path is never exercised
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 20/100
Línea de trabajo
Start with Lib/test/test_str.py beside test_find and review string_tests.BaseTest.test_adaptive_find to match its existing long-string setup. Add the proposed non-BMP character case and run the relevant string tests; done when the UCS4 adaptive search path is exercised. The issue says the author already has the change ready and plans to open a pull request.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
Objects/stringlib/fastsearch.h compiles adaptive_find once per character
width. The UCS4 copy never ran under the entire test suite, because the only test
that reaches the adaptive path, string_tests.BaseTest.test_adaptive_find, uses
ASCII strings.
Evidence
Coverage from a --coverage build of main running the full suite
(./python -m test -j4, 552 files, 52,070 tests):
Function 'ucs4lib_adaptive_find' Lines executed:0.00% of 39
Function 'ucs2lib_adaptive_find' Lines executed:66.67% of 39
Function 'ucs1lib_adaptive_find' Lines executed:71.79% of 39
Function 'asciilib_adaptive_find' Lines executed:79.49% of 39
Why the existing test misses it
The adaptive branch is taken only when, in Objects/stringlib/fastsearch.h:800:
- the haystack is at least 2500 characters,
- the needle is at least 100 characters (or the haystack at least 30000),
- the needle is at least a third of the haystack.
test_adaptive_find meets all three, but with 'a' and 'b', so the code that
runs is the ASCII or UCS1 instantiation. Nothing in the suite builds a haystack
that wide-and-long out of non-BMP characters, so the UCS4 instantiation stays
cold.
Proposal
Add a test next to test_find in Lib/test/test_str.py that repeats the same
shape with '\U0001d11e' and '\U0001d11f'. With that test present,
ucs4lib_adaptive_find goes from 0.00% to 89.74% of 39 lines, and the remaining
branches are the count and reverse-search modes, which are separate entry points.
This is a test-only change, so it does not alter behaviour. I have it ready and
will open a PR against this issue.
CPython versions tested on
CPython main branch (3.16.0a1+)
Operating systems tested on
Linux
Linked PRs
- gh-160502
- Lenguaje dominante
- Python
- Estrellas
- 77.7k
- Forks
- 38.3k
- Merge medio
- 13 h 30 min
- PR fusionados (30 d)
- 708
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de python/cpython
-
tarfile: extractfile(member).read() of a sparse member is slow due to repeated bytes concatenationAbiertoperformance stdlib
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
tests topic-profiling type-bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
python/cpython#160334 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
`iso2022_jp_3` encodes U+9B1D but decodes the result as U+9B1CPosiblemente ocupada @kinqsradio la tomó hace 2 días. Abiertoextension-modules type-bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
Remove unused FVS_* macrosAbiertointerpreter-core type-feature
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
python/cpython#160109 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
extension-modules type-bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
python/cpython#160001 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de python/cpython
Issues similares
-
PAC Wording
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Harmony OPeNDAP SubSetter (HOSS) Geographic production rssmif16d 7 XYZ_PROV
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
nasa/harmony-autotester#372 ·
-
Add DomainAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
disposable/disposable#318 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
developmentseed/titiler-cmr#270 ·
Los mantenedores suelen responder en 1 día
-
Chart: a failed venv install is marked ready, and the 10Gi venv PVC is too small for itPosiblemente ocupada @andyne13 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día