Free threaded: slicing a shared memoryview raises `ValueError: operation forbidden on released memoryview object`
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 35.9k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Bug report
Bug description:
Hello (and thanks for your amazing work),
I found that, on free threading Python, slicing a shared memoryview from several threads raises ValueError: operation forbidden on released memoryview object, even though nothing calls .release() and the underlying object is an immutable bytes. Stock (GIL) builds are unaffected.
data = bytes(1 << 20)
mv = memoryview(data) # ONE view, shared
# in each of 8 threads: bytes(mv[0:64])
See the attached reproduction script. Results are not deterministic: not all threads raise an exception. Here are the results on my machine after running it:
$ PYTHON_GIL=0 python3.15t repro_shared_memoryview_threads.py
python 3.15.0rc1 gil_enabled=False: 3/8 threads FAILED -> ValueError('operation forbidden on released memoryview object')
$ PYTHON_GIL=1 python3.15t repro_shared_memoryview_threads.py
python 3.15.0rc1 gil_enabled=True: all 8 threads OK
CPython versions tested on:
3.15
Operating systems tested on:
Linux
Linked PRs
- gh-155882
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con lo script allegato repro_shared_memoryview_threads.py e confronta i risultati con PYTHON_GIL=0 e PYTHON_GIL=1 su Python 3.15. Analizza il comportamento di shared memoryview nel runtime free-threaded; il lavoro sarà completato quando lo slicing concorrente non genererà più il ValueError segnalato. Il PR collegato gh-155882 indica che il lavoro è già in corso.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- backend
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100