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

gh-118814: Fix the TypeVar constructor when name is passed by keyword #122664

Merged
merged 2 commits into from
Aug 7, 2024

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Aug 4, 2024

Fix _PyArg_UnpackKeywordsWithVararg for the case when argument for positional-or-keyword parameter is passed by keyword. There was only one such case in the stdlib -- the TypeVar constructor.

…eyword

Fix _PyArg_UnpackKeywordsWithVararg for the case when argument for
positional-or-keyword parameter is passed by keyword.
There was only one such case in the stdlib -- the TypeVar constructor.
@picnixz
Copy link
Member

picnixz commented Aug 4, 2024

I think I also tried that approach but got a segfault with the example I showed. Could you check whether I may have missed something (or did something incorrect?):

vararg_with_many_args

    a: object
    b: object
    c: object
    d: object
    *args: object
    e: bool
    f: bool = False
    g: bool = False

and test:

  • Calling ac_tester.vararg_with_many_args(1, 2, 3, 4, e=5)
  • Calling ac_tester.vararg_with_many_args(1, 2, 3, 4, e=5, f=6)

@serhiy-storchaka
Copy link
Member Author

Oh, yes. There are several more bugs in Argument Clinic.

@serhiy-storchaka
Copy link
Member Author

But they are only Argument Clinic bugs and not related to this issue.

@serhiy-storchaka serhiy-storchaka merged commit 540fcc6 into python:main Aug 7, 2024
36 of 37 checks passed
@miss-islington-app
Copy link

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

@serhiy-storchaka serhiy-storchaka deleted the TypeVar-constructor branch August 7, 2024 20:30
@miss-islington-app
Copy link

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 540fcc62f5da982b79504221cac01bfab8b73ba1 3.13

@miss-islington-app
Copy link

Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 540fcc62f5da982b79504221cac01bfab8b73ba1 3.12

serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Aug 7, 2024
…ed by keyword (pythonGH-122664)

Fix _PyArg_UnpackKeywordsWithVararg for the case when argument for
positional-or-keyword parameter is passed by keyword.
There was only one such case in the stdlib -- the TypeVar constructor.
(cherry picked from commit 540fcc6)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Aug 7, 2024

GH-122806 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Aug 7, 2024
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this pull request Aug 7, 2024
…ed by keyword (pythonGH-122664)

Fix _PyArg_UnpackKeywordsWithVararg for the case when argument for
positional-or-keyword parameter is passed by keyword.
There was only one such case in the stdlib -- the TypeVar constructor.
(cherry picked from commit 540fcc6)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Aug 7, 2024

GH-122807 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Aug 7, 2024
@serhiy-storchaka serhiy-storchaka removed their assignment Aug 7, 2024
Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this!

serhiy-storchaka added a commit that referenced this pull request Aug 8, 2024
…keyword (GH-122664) (GH-122806)

Fix _PyArg_UnpackKeywordsWithVararg for the case when argument for
positional-or-keyword parameter is passed by keyword.
There was only one such case in the stdlib -- the TypeVar constructor.
(cherry picked from commit 540fcc6)
serhiy-storchaka added a commit that referenced this pull request Aug 8, 2024
…keyword (GH-122664) (GH-122807)

Fix _PyArg_UnpackKeywordsWithVararg for the case when argument for
positional-or-keyword parameter is passed by keyword.
There was only one such case in the stdlib -- the TypeVar constructor.
(cherry picked from commit 540fcc6)
blhsing pushed a commit to blhsing/cpython that referenced this pull request Aug 22, 2024
…eyword (pythonGH-122664)

Fix _PyArg_UnpackKeywordsWithVararg for the case when argument for
positional-or-keyword parameter is passed by keyword.
There was only one such case in the stdlib -- the TypeVar constructor.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants