Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/core/IronPython/Compiler/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,7 @@ private Parameter[] ParseParameterList(TokenKind terminator, bool allowAnnotatio
HashSet<string> names = new HashSet<string>(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;
Expand All @@ -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;
Expand Down