From fc144d96580c636001d39a2c06156c5919643f63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lozier?= Date: Sat, 21 Feb 2026 21:58:25 -0500 Subject: [PATCH] Accept positional-only arguments syntax --- src/core/IronPython/Compiler/Parser.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/core/IronPython/Compiler/Parser.cs b/src/core/IronPython/Compiler/Parser.cs index 9161912bd..519e4b8da 100644 --- a/src/core/IronPython/Compiler/Parser.cs +++ b/src/core/IronPython/Compiler/Parser.cs @@ -1201,6 +1201,7 @@ private Parameter[] ParseParameterList(TokenKind terminator, bool allowAnnotatio HashSet names = new HashSet(StringComparer.Ordinal); bool needDefault = false; bool readMultiply = false; + bool readTrueDivide = false; bool hasKeywordOnlyParameter = false; // we want these to be the last two parameters Parameter listParameter = null; @@ -1221,7 +1222,14 @@ private Parameter[] ParseParameterList(TokenKind terminator, bool allowAnnotatio break; } - if (MaybeEat(TokenKind.Multiply)) { + if (MaybeEat(TokenKind.TrueDivide)) { // accept syntax for positional-only parameters from Python 3.8 + if (position == 0 || readMultiply || readTrueDivide) { + ReportSyntaxError(_lookahead); + return null; + } + + readTrueDivide = true; + } else if (MaybeEat(TokenKind.Multiply)) { if (readMultiply) { ReportSyntaxError(_lookahead); return null;