Skip to content
Closed
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions Lib/test/test_ast/test_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,10 @@ def test_classattrs(self):
# Arbitrary keyword arguments are supported (but deprecated)
with self.assertWarns(DeprecationWarning):
self.assertEqual(ast.Constant(1, foo='bar').foo, 'bar')
# gh-144169: non-string keys must not crash
with self.assertWarns(DeprecationWarning):
with self.assertRaises(TypeError):
ast.Constant(1, **{object(): 'bar'})

with self.assertRaisesRegex(TypeError, "Constant got multiple values for argument 'value'"):
ast.Constant(1, value=2)
Expand Down
2 changes: 1 addition & 1 deletion Parser/asdl_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ def visitModule(self, mod):
else if (contains == 0) {
if (PyErr_WarnFormat(
PyExc_DeprecationWarning, 1,
"%.400s.__init__ got an unexpected keyword argument '%U'. "
"%.400s.__init__ got an unexpected keyword argument %R. "
"Support for arbitrary keyword arguments is deprecated "
"and will be removed in Python 3.15.",
Py_TYPE(self)->tp_name, key
Expand Down
2 changes: 1 addition & 1 deletion Python/Python-ast.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading