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;