GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Two CPython 3.11 syntax changes involving * operator are unsupported · Issue #4479 · RustPython/RustPython

Two CPython 3.11 syntax changes involving * operator are unsupported #4479

New issue
Copy link
New issue
Copy link
Closed
#6530
Closed
Two CPython 3.11 syntax changes involving * operator are unsupported#4479
#6530
Copy link
Assignees
youknowonecopilot-swe-agent
Labels
A-vmArea: virtual machineArea: virtual machine

Description

@ned2
ned2
opened on Jan 31, 2023
Issue body actions

Feature

In Python 3.11, the except* was added for working with ExceptionGroups. The availability of ExceptionGroup itself will depend on #4247, but in the meantime, the following snippet is valid CPython 3.11 that currently throws a SyntaxError in RustPython:

try:
    print("yay")
except* Exception as e:
    print("oh no")

I discovered this while digging into some code that ruff cannot handle, which on the surface looks like a slightly different issue. The following snippet is valid CPython 3.11 but also throws a SyntaxError in RustPython:

my_dict = {}
my_dict[*"ab"] = 1

The expected behaviour is that the string should be unpacked and the value of the dict with key ('a','b') set to 1. In case that feels a little contrived, here's what I was doing at the time:

import typing
values = ["dog", "cat"]
Pets = typing.Literal[*values]

Python Documentation

The first incompatibility issue is clearly documented here, and called out under New syntax features in What’s New In Python 3.11.

However the second incompatibility is not documented in the changelog, and I did confirm that this was new in CPython 3.11, as the snippet throws a syntax error in 3.10.

I wonder if this was a (nice?) side-effect of the changes that were introduced to make except* work. There is a seemingly related precedent for this, where using * to unpack without parentheses in for statements was enabled via the PEG parser in CPython 3.9, but was not noticed then and only documented in 3.11.

Reacted by DimitrisJim
Reacted by Copilot

Activity

  1. DimitrisJim commented on Jan 31, 2023

    @DimitrisJim
    DimitrisJim
    on Jan 31, 2023
    Member
    More actions

    Unpacking in indexes was introduced with PEP 646 (specifically, see here). I guess it isn't documented in that section because it isn't new syntax per se, more of a change in where * is allowed (it probably should be in the Other Language Changes though, which also mentions another small syntax change).

    Reacted by William Andrea
  2. ned2 commented on Jan 31, 2023

    @ned2
    ned2
    on Jan 31, 2023
    Author
    More actions

    ahhh nice yes, that's exactly it! turns out that is a hard document to find with Google. I certainly looked for it.

    yeah agreed, would have been good to see that in the Other Language Changes section

  3. charliermarsh commented on Feb 21, 2023

    @charliermarsh
    charliermarsh
    on Feb 21, 2023
    Collaborator
    More actions

    Fixed :)

    Reacted by Ned Letcher
  4. youknowone commented on Feb 21, 2023

    @youknowone
    youknowone
    on Feb 21, 2023
    Member
    More actions

    resolved by @charliermarsh , thanks!

  5. youknowone
    closed this as completedon Feb 21, 2023
  6. youknowone
    reopened this on Feb 21, 2023
  7. youknowone commented on Feb 21, 2023

    @youknowone
    youknowone
    on Feb 21, 2023
    Member
    More actions

    I am sorry, the parser part is done but runtime is not.

    Reacted by Charlie Marsh
  8. charliermarsh commented on Feb 21, 2023

    @charliermarsh
    charliermarsh
    on Feb 21, 2023
    Collaborator
    More actions

    Ah correct!

  9. fanninpm commented on Feb 21, 2023

    @fanninpm
    fanninpm
    on Feb 21, 2023
    Contributor
    More actions

    cc @qingshi163 for inclusion in #4423

  10. DimitrisJim commented on Feb 22, 2023

    @DimitrisJim
    DimitrisJim
    on Feb 22, 2023
    Member
    More actions

    let's break this up in two issues? they touch on different subjects and the unpacking might be a good issue for someone to tackle. (plus, the title doesn't make it obvious that the parsing part of this is solved but the runtime isn't)

    Reacted by Jeong, YunWon
  11. youknowone
    added
    A-vmArea: virtual machineArea: virtual machine
    on Feb 22, 2023
  12. youknowone
    assigned
    Copilot
    and
    youknowone
    on Dec 25, 2025
  13. youknowone
    closed this as completedin #6530on Dec 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • Copilot
  • @youknowone
    youknowone

Labels

A-vmArea: virtual machineArea: virtual machine

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.