python / python/cpython

Accidental name bindings with structural pattern matching

オープン
#93,059 コメント 7 件 リアクション 2 件 担当者 1 名 GitHub で見る

@brandtbucher がすでに取り組んでいます。

2022年5月22日 から。

interpreter-core type-bug
主要言語
Python
スター
77.2k
フォーク
36k
PR マージ指標
PR 指標を取得中

説明

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.

bug.zip

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)

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。