bpo-36290: Fix keytword collision handling in AST node constructors (GH-12382)

(cherry picked from commit c73914a562580ae72048876cb42ed8e76e2c83f9)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@lenstra.fr>
diff --git a/Lib/ast.py b/Lib/ast.py
index 52e51b4..6a5b39e 100644
--- a/Lib/ast.py
+++ b/Lib/ast.py
@@ -524,6 +524,13 @@
         return type.__instancecheck__(cls, inst)
 
 def _new(cls, *args, **kwargs):
+    for key in kwargs:
+        if key not in cls._fields:
+            # arbitrary keyword arguments are accepted
+            continue
+        pos = cls._fields.index(key)
+        if pos < len(args):
+            raise TypeError(f"{cls.__name__} got multiple values for argument {key!r}")
     if cls in _const_types:
         return Constant(*args, **kwargs)
     return Constant.__new__(cls, *args, **kwargs)