-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17688 from github/tausbn/python-3.13-default-type…
…-parser-support Python: Add support for type parameter defaults
- Loading branch information
Showing
24 changed files
with
36,226 additions
and
32,551 deletions.
There are no files selected for viewing
1,236 changes: 1,236 additions & 0 deletions
1,236
python/downgrades/5af903da088e3746aa283700a43a779302453523/old.dbscheme
Large diffs are not rendered by default.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
python/downgrades/5af903da088e3746aa283700a43a779302453523/py_exprs.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// We must wrap the DB types, as these cannot appear in argument lists | ||
class TypeParameter_ extends @py_type_parameter { | ||
string toString() { result = "TypeParameter" } | ||
} | ||
|
||
class Expr_ extends @py_expr { | ||
string toString() { result = "Expr" } | ||
} | ||
|
||
class ExprParent_ extends @py_expr_parent { | ||
string toString() { result = "ExprParent" } | ||
} | ||
|
||
class TypeVar_ extends @py_TypeVar, TypeParameter_ { | ||
override string toString() { result = "TypeVar" } | ||
} | ||
|
||
class TypeVarTuple_ extends @py_TypeVarTuple, TypeParameter_ { | ||
override string toString() { result = "TypeVarTuple" } | ||
} | ||
|
||
class ParamSpec_ extends @py_ParamSpec, TypeParameter_ { | ||
override string toString() { result = "ParamSpec" } | ||
} | ||
|
||
// From the dbscheme: | ||
// py_exprs(unique int id : @py_expr, | ||
// int kind: int ref, | ||
// int parent : @py_expr_parent ref, | ||
// int idx : int ref); | ||
query predicate py_exprs_without_type_parameter_defaults( | ||
Expr_ id, int kind, ExprParent_ parent, int idx | ||
) { | ||
py_exprs(id, kind, parent, idx) and | ||
// From the dbscheme | ||
// /* <Field> ParamSpec.default = 2, expr */ | ||
// /* <Field> TypeVar.default = 3, expr */ | ||
// /* <Field> TypeVarTuple.default = 2, expr */ | ||
(parent instanceof ParamSpec_ implies idx != 2) and | ||
(parent instanceof TypeVar_ implies idx != 3) and | ||
(parent instanceof TypeVarTuple_ implies idx != 2) | ||
} |
Oops, something went wrong.