Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

except* assumes that an exception group is truthy #90377

Closed
iritkatriel opened this issue Jan 1, 2022 · 4 comments
Closed

except* assumes that an exception group is truthy #90377

iritkatriel opened this issue Jan 1, 2022 · 4 comments
Labels
3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@iritkatriel
Copy link
Member

BPO 46219
Nosy @vedgar, @brandtbucher, @iritkatriel
PRs
  • bpo-46219, 46221: simplify except* implementation following exc_info changes. Move helpers to exceptions.c. Do not assume that exception groups are truthy. #30289
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2022-01-02.23:23:19.407>
    created_at = <Date 2022-01-01.10:42:47.213>
    labels = ['interpreter-core', 'type-bug', '3.11']
    title = 'except* assumes that an exception group is truthy'
    updated_at = <Date 2022-01-02.23:23:19.407>
    user = 'https://github.com/iritkatriel'

    bugs.python.org fields:

    activity = <Date 2022-01-02.23:23:19.407>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-01-02.23:23:19.407>
    closer = 'iritkatriel'
    components = ['Interpreter Core']
    creation = <Date 2022-01-01.10:42:47.213>
    creator = 'iritkatriel'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46219
    keywords = ['patch']
    message_count = 4.0
    messages = ['409454', '409460', '409498', '409540']
    nosy_count = 3.0
    nosy_names = ['veky', 'brandtbucher', 'iritkatriel']
    pr_nums = ['30289']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue46219'
    versions = ['Python 3.11']

    @iritkatriel
    Copy link
    Member Author

    except* checks truthiness of the output of PREP_RERAISE_STAR, and this gives the wrong result for false ExceptionGroup subclasses. See
    #30302 (comment)

    @iritkatriel iritkatriel added 3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Jan 1, 2022
    @iritkatriel iritkatriel changed the title except* assumes that an exception group is truth except* assumes that an exception group is truthy Jan 1, 2022
    @iritkatriel iritkatriel changed the title except* assumes that an exception group is truth except* assumes that an exception group is truthy Jan 1, 2022
    @iritkatriel
    Copy link
    Member Author

    ... "for falsy ExceptionGroup subclasses"

    @vedgar
    Copy link
    Mannequin

    vedgar mannequin commented Jan 2, 2022

    A long time ago, Python documentation used true and false as adjectives (as opposed to True and False, which are proper names for canonical true/false objects). I think it was BDFL's preference back then.

    In the meantime, I suppose through JS's influence, Python documentation started to adopt ancient Perl terminology, where truhy and falsy were used as adjectives standing for what was previously known as true and false. I really don't like it, and I think English language is clear enough here (given the help of code font and capital letter) that we don't need to invent new words. Of course, it is up to the community to decide (and maybe the steering council might issue an opinion), but I'm telling you the history and my preference.

    @iritkatriel
    Copy link
    Member Author

    New changeset 65e7c1f by Irit Katriel in branch 'main':
    bpo-46219, 46221: simplify except* implementation following exc_info changes. Move helpers to exceptions.c. Do not assume that exception groups are truthy. (GH-30289)
    65e7c1f

    @iritkatriel iritkatriel added the type-bug An unexpected behavior, bug, or error label Jan 2, 2022
    @iritkatriel iritkatriel added the type-bug An unexpected behavior, bug, or error label Jan 2, 2022
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant