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

ContextVar[str] should return ContextVar class, not None #83160

Closed
asvetlov opened this issue Dec 5, 2019 · 8 comments
Closed

ContextVar[str] should return ContextVar class, not None #83160

asvetlov opened this issue Dec 5, 2019 · 8 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes easy extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@asvetlov
Copy link
Contributor

asvetlov commented Dec 5, 2019

BPO 38979
Nosy @asvetlov, @miss-islington, @amiremohamadi
PRs
  • bpo-38979: fix ContextVar "__class_getitem__" method #17497
  • [3.8] bpo-38979: fix ContextVar "__class_getitem__" method (GH-17497) #17505
  • [3.7] bpo-38979: fix ContextVar "__class_getitem__" method (GH-17497) #17506
  • [3.8] bpo-38979: fix ContextVar "__class_getitem__" method (GH-17497) #17507
  • 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 2019-12-08.12:49:21.791>
    created_at = <Date 2019-12-05.13:04:18.933>
    labels = ['easy', 'type-bug', '3.8', '3.9', 'extension-modules', '3.7']
    title = 'ContextVar[str] should return ContextVar class, not None'
    updated_at = <Date 2019-12-08.12:49:21.790>
    user = 'https://github.com/asvetlov'

    bugs.python.org fields:

    activity = <Date 2019-12-08.12:49:21.790>
    actor = 'asvetlov'
    assignee = 'none'
    closed = True
    closed_date = <Date 2019-12-08.12:49:21.791>
    closer = 'asvetlov'
    components = ['Extension Modules']
    creation = <Date 2019-12-05.13:04:18.933>
    creator = 'asvetlov'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 38979
    keywords = ['patch', 'easy (C)']
    message_count = 8.0
    messages = ['357850', '357877', '357887', '357963', '357964', '357997', '357998', '358001']
    nosy_count = 3.0
    nosy_names = ['asvetlov', 'miss-islington', 'Amir']
    pr_nums = ['17497', '17505', '17506', '17507']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue38979'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

    @asvetlov
    Copy link
    Contributor Author

    asvetlov commented Dec 5, 2019

    The issue is minor, I suspect nobody wants to derive from ContextVar class.

    The generic implementation for __class_getitem__ is returning unmodified self argument. Yuri, is there a reason to behave differently in the case of ContextVar?

    If no, we can mark the issue as easy(C) and wait for a volunteer, the fix seems trivial.

    @asvetlov asvetlov added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error labels Dec 5, 2019
    @1st1
    Copy link
    Member

    1st1 commented Dec 5, 2019

    The issue is minor, I suspect nobody wants to derive from ContextVar class.

    I don't think that's allowed, actually.

    The generic implementation for __class_getitem__ is returning unmodified self argument. Yuri, is there a reason to behave differently in the case of ContextVar?

    No, just an oversight, probably.

    @DahlitzFlorian
    Copy link
    Mannequin

    DahlitzFlorian mannequin commented Dec 5, 2019

    I'd be happy to work on this!

    @amiremohamadi
    Copy link
    Mannequin

    amiremohamadi mannequin commented Dec 7, 2019

    @asvetlov I have a question! Should "contextvar_cls_getitem" function be changed? And can you please help me figure out how to change it?

    @asvetlov
    Copy link
    Contributor Author

    asvetlov commented Dec 7, 2019

    I think it should look like the corresponding function from multidict: https://github.com/aio-libs/multidict/blob/master/multidict/_multidict.c#L803-L808

    Please note, the method definition also should be updated, see https://github.com/aio-libs/multidict/blob/master/multidict/_multidict.c#L923-L928 for inspiration.

    @miss-islington
    Copy link
    Contributor

    New changeset 28c9163 by Miss Islington (bot) (AMIR) in branch 'master':
    bpo-38979: fix ContextVar "__class_getitem__" method (GH-17497)
    28c9163

    @miss-islington
    Copy link
    Contributor

    New changeset 9baa870 by Miss Islington (bot) in branch '3.7':
    bpo-38979: fix ContextVar "__class_getitem__" method (GH-17497)
    9baa870

    @miss-islington
    Copy link
    Contributor

    New changeset 960fca1 by Miss Islington (bot) in branch '3.8':
    bpo-38979: fix ContextVar "__class_getitem__" method (GH-17497)
    960fca1

    @asvetlov asvetlov closed this as completed Dec 8, 2019
    @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.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes easy extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants