Skip to content

Conversation

@JelleZijlstra
Copy link
Member

@JelleZijlstra JelleZijlstra commented Jan 23, 2026

@vstinner
Copy link
Member

I closed my PR #144177 since this one is more complete.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I just left minor suggestions.


def test_replace_non_str_kwarg(self):
node = ast.Name(id="x")
with self.assertRaisesRegex(TypeError, "got an unexpected keyword argument <object object"):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is longer than 80 columns, I suggest to write it like that:

Suggested change
with self.assertRaisesRegex(TypeError, "got an unexpected keyword argument <object object"):
errmsg = "got an unexpected keyword argument <object object"
with self.assertRaisesRegex(TypeError, errmsg):

Comment on lines +3314 to +3317
with (
self.assertRaises(TypeError),
self.assertWarnsRegex(DeprecationWarning, "got an unexpected keyword argument <object object"),
):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last line is longer than 80 columns. I suggest to write it like that:

Suggested change
with (
self.assertRaises(TypeError),
self.assertWarnsRegex(DeprecationWarning, "got an unexpected keyword argument <object object"),
):
warn_msg = "got an unexpected keyword argument <object object"
with (
self.assertRaises(TypeError),
self.assertWarnsRegex(DeprecationWarning, warn_msg),
):

Comment on lines +945 to 946
"%.400s got multiple values for argument %R",
Py_TYPE(self)->tp_name, key);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are modifying the error message, you must use the safer %T format:

Suggested change
"%.400s got multiple values for argument %R",
Py_TYPE(self)->tp_name, key);
"%T got multiple values for argument %R",
self, key);

Same remark for the two other changes below.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting merge needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants