mmap extended slicing ignores the step; negative steps raise java.lang.IndexOutOfBoundsException
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 64/100
Direção de pesquisa
Start by running the three-line reproduction script on GraalPy and comparing it with CPython's output. The payload names no source files, so locate the mmap implementation by searching for the slice handling. CPython's test_mmap.MmapTests.test_extended_getslice is the target. Done when extended slices with positive and negative steps match bytearray and the negative-step case no longer raises a Java IndexOutOfBoundsException.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
I found this while benchmarking the conformance of alternative Python implementations against CPython: the same standard library cases and selected CPython tests run on CPython, PyPy, GraalPy and RustPython.
Reading a mmap.mmap slice with a step other than 1 returns the contiguous bytes instead of every n-th byte. A negative step raises a Java IndexOutOfBoundsException that is not catchable as a Python exception. mmap objects are documented to behave like bytearray, and CPython's test_mmap.MmapTests.test_extended_getslice covers this; it fails on GraalPy.
Reproduction
import mmap
data = bytes(range(10))
region = mmap.mmap(-1, len(data))
region[:] = data
print(region[::2].hex(), data[::2].hex())
print(region[1:7:3].hex(), data[1:7:3].hex())
print(region[::-1].hex(), data[::-1].hex())
CPython 3.12.15:
0002040608 0002040608
0104 0104
09080706050403020100 09080706050403020100
GraalPy:
0001020304 0002040608
0102 0104
java.lang.IndexOutOfBoundsException
The length of the result is right; the step is not applied. Assigning to an extended slice (region[::2] = b"xyz") works.
Versions
- GraalPy 25.2.4 Community (Python 3.12.8), Linux x86-64 and macOS aarch64 standalone builds
- GraalPy 25.6.5 Community (Python 3.13.14), macOS aarch64 standalone build
This report was drafted with the help of AI. The reproductions were run on the GraalPy versions listed above, and on CPython 3.12.15 for the expected output.
- Linguagem predominante
- Python
- Estrelas
- 1.7k
- Forks
- 167
- Merge médio
- 3d 11h
- PRs com merge (30d)
- 68
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
- Sem 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 oracle/graalpython
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
oracle/graalpython#1105 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
oracle/graalpython#1102 ·
Mantenedores costumam responder em até 1 dia
-
mmap.mmap.move() is missingTalvez já em andamento @deronnax assumiu há 3 dias. Aberta
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 62/100
oracle/graalpython#1368 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 22/100
oracle/graalpython#1366 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
oracle/graalpython#1365 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de oracle/graalpython
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
bug improve content
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
opensafely/documentation#2102 ·
Mantenedores costumam responder em até 1 dia
-
difficulty:1 documentation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
MakazhanAlpamys/Soup#3533 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
onyx-dot-app/onyx#18730 ·
Mantenedores costumam responder em até 1 dia