← 返回首页
gh-100530: Change the error message for `MatchClass` by sobolevn · Pull Request #103576 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

gh-100530: Change the error message for MatchClass#103576

Merged
brandtbucher merged 2 commits into
python:mainfrom
sobolevn:issue-100530
Apr 18, 2023
Merged

gh-100530: Change the error message for MatchClass#103576
brandtbucher merged 2 commits into
python:mainfrom
sobolevn:issue-100530

Conversation

sobolevn commented Apr 16, 2023
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

brandtbucher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Thanks, just one suggestion on the NEWS entry:

Comment thread Misc/NEWS.d/next/Core and Builtins/2023-04-16-14-38-39.gh-issue-100530.OR6-sn.rst Outdated Show resolved Hide resolved
…e-100530.OR6-sn.rst Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>

Copy link
Copy Markdown
Member

Thanks!

brandtbucher merged commit 07804ce into python:main Apr 18, 2023

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot aarch64 Fedora Stable Clang 3.x has failed when building commit 07804ce.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/234/builds/3465) and take a look at the build logs.
  4. Check if the failure is related to this commit (07804ce) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/all/#builders/234/builds/3465

Failed tests:

  • test_asyncio

Summary of the results of the build (if available):

==

Click to see traceback logs
remote: Enumerating objects: 16, done. remote: Counting objects: 6% (1/16) remote: Counting objects: 12% (2/16) remote: Counting objects: 18% (3/16) remote: Counting objects: 25% (4/16) remote: Counting objects: 31% (5/16) remote: Counting objects: 37% (6/16) remote: Counting objects: 43% (7/16) remote: Counting objects: 50% (8/16) remote: Counting objects: 56% (9/16) remote: Counting objects: 62% (10/16) remote: Counting objects: 68% (11/16) remote: Counting objects: 75% (12/16) remote: Counting objects: 81% (13/16) remote: Counting objects: 87% (14/16) remote: Counting objects: 93% (15/16) remote: Counting objects: 100% (16/16) remote: Counting objects: 100% (16/16), done. remote: Compressing objects: 14% (1/7) remote: Compressing objects: 28% (2/7) remote: Compressing objects: 42% (3/7) remote: Compressing objects: 57% (4/7) remote: Compressing objects: 71% (5/7) remote: Compressing objects: 85% (6/7) remote: Compressing objects: 100% (7/7) remote: Compressing objects: 100% (7/7), done. remote: Total 9 (delta 7), reused 4 (delta 2), pack-reused 0 From https://github.com/python/cpython * branch main -> FETCH_HEAD Note: switching to '07804ce24c3103ee1bb141af31b9a1a0f92f5e43'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example: git switch -c <new-branch-name> Or undo this operation with: git switch - Turn off this advice by setting config variable advice.detachedHead to false HEAD is now at 07804ce24c GH-100530: Change the error message for non-class class patterns (GH-103576) Switched to and reset branch 'main' Timeout (0:15:00)! Thread 0x0000ffffb9f15020 (most recent call first): File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/test/test_asyncio/test_tasks.py", line 137 in __del__ File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/test/test_asyncio/test_tasks.py", line 142 in test_task_del_collect File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/unittest/case.py", line 589 in _callTestMethod File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/unittest/case.py", line 634 in run File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/unittest/case.py", line 690 in __call__ File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/unittest/suite.py", line 122 in run File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/unittest/suite.py", line 84 in __call__ File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/unittest/suite.py", line 122 in run File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/unittest/suite.py", line 84 in __call__ File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/unittest/suite.py", line 122 in run File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/unittest/suite.py", line 84 in __call__ File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/unittest/suite.py", line 122 in run File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/unittest/suite.py", line 84 in __call__ File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/unittest/suite.py", line 122 in run File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/unittest/suite.py", line 84 in __call__ File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/unittest/runner.py", line 240 in run File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/test/support/__init__.py", line 1106 in _run_suite File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/test/support/__init__.py", line 1232 in run_unittest File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/test/libregrtest/runtest.py", line 281 in _test_module File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/test/libregrtest/runtest.py", line 317 in _runtest_inner2 File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/test/libregrtest/runtest.py", line 360 in _runtest_inner File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/test/libregrtest/runtest.py", line 235 in _runtest File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/test/libregrtest/runtest.py", line 265 in runtest File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/test/libregrtest/main.py", line 365 in rerun_failed_tests File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/test/libregrtest/main.py", line 783 in _main File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/test/libregrtest/main.py", line 738 in main File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/test/libregrtest/main.py", line 802 in main File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/test/__main__.py", line 2 in <module> File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/runpy.py", line 88 in _run_code File "/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/Lib/runpy.py", line 198 in _run_module_as_main make: *** [Makefile:1960: buildbottest] Error 1 Cannot open file '/home/buildbot/buildarea/3.x.cstratak-fedora-stable-aarch64.clang/build/test-results.xml' for upload

carljm added a commit to carljm/cpython that referenced this pull request Apr 20, 2023
* main: (24 commits) pythongh-98040: Move the Single-Phase Init Tests Out of test_imp (pythongh-102561) pythongh-83861: Fix datetime.astimezone() method (pythonGH-101545) pythongh-102856: Clean some of the PEP 701 tokenizer implementation (python#103634) pythongh-102856: Skip test_mismatched_parens in WASI builds (python#103633) pythongh-102856: Initial implementation of PEP 701 (python#102855) pythongh-103583: Add ref. dependency between multibytecodec modules (python#103589) pythongh-83004: Harden msvcrt further (python#103420) pythonGH-88342: clarify that `asyncio.as_completed` accepts generators yielding tasks (python#103626) pythongh-102778: IDLE - make sys.last_exc available in Shell after traceback (python#103314) pythongh-103582: Remove last references to `argparse.REMAINDER` from docs (python#103586) pythongh-103583: Always pass multibyte codec structs as const (python#103588) pythongh-103617: Fix compiler warning in _iomodule.c (python#103618) pythongh-103596: [Enum] do not shadow mixed-in methods/attributes (pythonGH-103600) pythonGH-100530: Change the error message for non-class class patterns (pythonGH-103576) pythongh-95299: Remove lingering setuptools reference in installer scripts (pythonGH-103613) [Doc] Fix a typo in optparse.rst (python#103504) pythongh-101100: Fix broken reference `__format__` in `string.rst` (python#103531) pythongh-95299: Stop installing setuptools as a part of ensurepip and venv (python#101039) pythonGH-103484: Docs: add linkcheck allowed redirects entries for most cases (python#103569) pythongh-67230: update whatsnew note for csv changes (python#103598) ...
sharkdp added a commit to sharkdp/cpython that referenced this pull request Feb 11, 2026
When trying to use a class pattern to match on a non-class object, we currently get the following error message: Traceback (most recent call last): File "/tmp/test.py", line 2, in <module> case len(): ~~~^^ TypeError: called match pattern must be a class The terminology "called match pattern" here is a bit confusing. It's not used anywhere else as far as I can tell, and for a beginner, it might read like something is actually being called here. The documentation consistently refers to these patterns as "class patterns": * https://docs.python.org/3/reference/compound_stmts.html#class-patterns * https://peps.python.org/pep-0635/#class-patterns * https://docs.python.org/3/library/ast.html#ast.MatchClass * https://docs.python.org/3/reference/datamodel.html#customizing-positional-arguments-in-class-pattern-matching I am therefore suggesting to change the message to "class pattern must refer to a class". See python#103576 for a PR that previously changed this message (from "… must be a type" to "… must be a class").
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Footer

© 2026 GitHub, Inc.