Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbdb9c1d

Browse files
authored
Merge pull requestRustPython#4382 from anilbey/duplicate-keyword-arg
arg name to be written upon duplicate kwargs errorRustPython#4381
2 parents3a5716d +b76441b commitbdb9c1d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

‎compiler/parser/src/error.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub enum LexicalErrorType {
2424
DuplicateArgumentError(String),
2525
PositionalArgumentError,
2626
UnpackedArgumentError,
27-
DuplicateKeywordArgumentError,
27+
DuplicateKeywordArgumentError(String),
2828
UnrecognizedToken{tok:char},
2929
FStringError(FStringErrorType),
3030
LineContinuationError,
@@ -54,8 +54,8 @@ impl fmt::Display for LexicalErrorType {
5454
LexicalErrorType::DuplicateArgumentError(arg_name) =>{
5555
write!(f,"duplicate argument '{arg_name}' in function definition")
5656
}
57-
LexicalErrorType::DuplicateKeywordArgumentError =>{
58-
write!(f,"keyword argument repeated")
57+
LexicalErrorType::DuplicateKeywordArgumentError(arg_name) =>{
58+
write!(f,"keyword argument repeated: {arg_name}")
5959
}
6060
LexicalErrorType::PositionalArgumentError =>{
6161
write!(f,"positional argument follows keyword argument")

‎compiler/parser/src/function.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ pub fn parse_args(func_args: Vec<FunctionArgument>) -> Result<ArgumentList, Lexi
9292
ifletSome(keyword_name) =&name{
9393
if keyword_names.contains(keyword_name){
9494
returnErr(LexicalError{
95-
error:LexicalErrorType::DuplicateKeywordArgumentError,
95+
error:LexicalErrorType::DuplicateKeywordArgumentError(
96+
keyword_name.to_string(),
97+
),
9698
location: start,
9799
});
98100
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp