-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
AST optimizer skips PEP 696 type parameter defaults #123344
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
Labels
3.13
bugs and security fixes
3.14
bugs and security fixes
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
type-bug
An unexpected behavior, bug, or error
Comments
diff --git Python/ast_opt.c Python/ast_opt.c
index d7a26e64150..8907c6daec7 100644
--- Python/ast_opt.c
+++ Python/ast_opt.c
@@ -1087,6 +1087,7 @@ astfold_type_param(type_param_ty node_, PyArena *ctx_, _PyASTOptimizeState *stat
switch (node_->kind) {
case TypeVar_kind:
CALL_OPT(astfold_expr, expr_ty, node_->v.TypeVar.bound);
+ CALL_OPT(astfold_expr, expr_ty, node_->v.TypeVar.default_value);
break;
case ParamSpec_kind:
break; This might help someone in the future, I tested it locally:
|
The same change is also needed for the ParamSpec and TypeVarTuple cases though. |
If no one complains, I would like to work with @wrongnull on this |
JelleZijlstra
added a commit
that referenced
this issue
Aug 28, 2024
Co-authored-by: Kirill Podoprigora <[email protected]> Co-authored-by: Jelle Zijlstra <[email protected]>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Aug 28, 2024
…123377) (cherry picked from commit be083ce) Co-authored-by: Bogdan Romanyuk <[email protected]> Co-authored-by: Kirill Podoprigora <[email protected]> Co-authored-by: Jelle Zijlstra <[email protected]>
JelleZijlstra
added a commit
that referenced
this issue
Aug 28, 2024
… (#123427) (cherry picked from commit be083ce) Co-authored-by: Bogdan Romanyuk <[email protected]> Co-authored-by: Kirill Podoprigora <[email protected]> Co-authored-by: Jelle Zijlstra <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
3.13
bugs and security fixes
3.14
bugs and security fixes
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
type-bug
An unexpected behavior, bug, or error
Uh oh!
There was an error while loading. Please reload this page.
Bug report
Bug description:
cc @Eclips4. This is easy to fix but it might be better to wait for #122667 so we can test the fix better.
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: