Compiler RecursionError more likely to occur in 3.13
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:
Reference: https://github.com/sympy/sympy/issues/26692
There's a long expression in sympy that's causing a RecursionError in ast.c. The source of the RecursionError is https://github.com/python/cpython/blob/ffc8e21c80627c46be7a7467ee5427924fdeb885/Python/ast.c#L217.
This seems to happen with a 3.13 debug build due to a lower recursion limit. The error doesn't happen in 3.13 release.
Interestingly, the error doesn't happen in the 3.12 debug build, even though the recursion limit appears to be the same. This leads me to believe that 3.13 is causing more recursive calls than expected. I think we should investigate why 3.13 is making additional calls and/or raise the recursion limit.
Simple repro:
import ast
contents = "x = " + " * ".join(["1"] * 2000)
result = ast.parse(contents)
On 3.12 debug, this code runs fine. On 3.13 debug, this code causes a RecursionError even when we change 2000 to 500 (leading me to believe that it is not the case that 3.13 is just adding a constant number of additional calls).
CPython versions tested on:
3.12, 3.13
Operating systems tested on:
Linux
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 riproducendo l’espressione con ast.parse nelle build di debug di 3.12 e 3.13, quindi esamina Python/ast.c in corrispondenza del controllo della ricorsione segnalato intorno alla riga 217. Determina perché 3.13 effettua chiamate ricorsive aggiuntive o se il limite di ricorsione è inappropriato; il lavoro è completato quando la regressione è stata risolta e verificata, e la riproduzione fornita non fallisce più.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- compilers
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 32/100