Accidental name bindings with structural pattern matching
@brandtbucher ci sta già lavorando.
Dal 22/5/2022.
- Lingua principale
- Python
- Stelle
- 77.2k
- Fork
- 36k
- Metriche di merge delle PR
- Metriche PR in attesa
Descrizione
Bug report
Your environment
- CPython versions tested on: 3.10.2, 3.11.0a6
- Operating system and architecture: macOS Monterey, Version 12.3.1. Mac mini running M1, Apple silicon.
Steps to reproduce:
Run the code in bug.py, attached.
The output on my Mac mini is:
% python bug.py
Cheese Sandwich
Search for 'match' in the code. Notice that one of the terms matches
the only str in the list, "Cheese Sandwich". Later we create a dataclass
of type PersonHeight. On the last line of the file, we print the type
of one of the fields in a PersonHeight object. Note that it is not <class 'str'> as it should be,
but "Cheese Sandwich"
If we comment out the match expression, we get the correct behavior
(see comment below in code)
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.
Valutazione
Questa issue non è ancora stata valutata.