From 5a7468e5041de1c34a8be8bd1b768843d609ef33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20K=C3=BChn?= Date: Fri, 7 Aug 2026 19:05:56 +0200 Subject: [PATCH 1/2] parse class bases like function arguments --- python/extractor/tsg-python/python.tsg | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/python/extractor/tsg-python/python.tsg b/python/extractor/tsg-python/python.tsg index c832f7e63219..6f11b4b87b54 100644 --- a/python/extractor/tsg-python/python.tsg +++ b/python/extractor/tsg-python/python.tsg @@ -1286,11 +1286,15 @@ ; In particular, `keyword_argument` nodes have a `name` field, and `dictionary_splat` ; nodes have a `value` field. (class_definition - superclasses: (argument_list element: (_ !value !name) @arg) + superclasses: (argument_list element: (_) @arg) ) @class { - edge @class.class_expr -> @arg.node - attr (@class.class_expr -> @arg.node) bases = (named-child-index @arg) + if (not (or + (instance-of @arg "keyword_argument") + (instance-of @arg "dictionary_splat"))) { + edge @class.class_expr -> @arg.node + attr (@class.class_expr -> @arg.node) bases = (named-child-index @arg) + } } ; Class.keywords of the form `foo=bar` From 1e28768593176a7c5a0fad35223657e1a0003b6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20K=C3=BChn?= Date: Fri, 7 Aug 2026 19:06:11 +0200 Subject: [PATCH 2/2] remove outdated comment --- python/extractor/tsg-python/python.tsg | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/python/extractor/tsg-python/python.tsg b/python/extractor/tsg-python/python.tsg index 6f11b4b87b54..ff5de34da594 100644 --- a/python/extractor/tsg-python/python.tsg +++ b/python/extractor/tsg-python/python.tsg @@ -1282,9 +1282,7 @@ attr (@class.inner_scope -> @stmt.node) body = (named-child-index @stmt) } -; Class.bases - using `(_ !value !name)` as a proxy for all non-keyword arguments. -; In particular, `keyword_argument` nodes have a `name` field, and `dictionary_splat` -; nodes have a `value` field. +; Class.bases (class_definition superclasses: (argument_list element: (_) @arg) ) @class