test_str: the UCS4 adaptive search path is never exercised
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 20/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Linguagem predominante
- Python
- Estrelas
- 77.7k
- Forks
- 38.3k
- Merge médio
- 14h 29min
- PRs com merge (30d)
- 699
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de python/cpython
-
topic-socket type-bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
python/cpython#160561 · 7 comentários ·
Mantenedores costumam responder em até 1 dia
-
tests topic-profiling type-bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
python/cpython#160334 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
extension-modules type-bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
Mantenedores costumam responder em até 1 dia
-
Remove unused FVS_* macrosAbertainterpreter-core type-feature
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 78/100
python/cpython#160109 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
extension-modules type-bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
python/cpython#160001 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
Todas as issues de python/cpython
Issues semelhantes
-
request-theme
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 66/100
LizardByte/ThemerrDB#9575 ·
Mantenedores costumam responder em até 1 dia
-
Author Page: noshin-nawalAbertaauthor-page correction
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
acl-org/acl-anthology#10599 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
zilliztech/memsearch#818 ·
Mantenedores costumam responder em até 1 dia
-
[FAQ] Commit ID for ProjectsTalvez já em andamento @github-actions assumiu hoje. Abertafaq-proposal
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 84/100
DataTalksClub/faq#503 · 1 comentário ·
Mantenedores costumam responder em até 2 dias
-
README.zh-CN/ja/es still hard-code 501 test counts after README.md went count-freeTalvez já em andamento @Aaqibhafeezkhan assumiu hoje. Abertabeginner documentation good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
BistaDinesh03/critique#164 · 1 comentário ·
Mantenedores costumam responder em até 1 dia