◐ Shell
clean mode source ↗

eval() documentation is wrong about keyword arguments

The docs for eval() say it takes keyword arguments, which is incorrect:

eval(expression, /, globals=None, locals=None)

For example:

>>> eval('a', locals={'a': 0})
  ...
TypeError: eval() takes no keyword arguments

Meanwhile, help(eval) has the correct signature:

eval(source, globals=None, locals=None, /)

I found a previous, similar issue, #69996, which was resolved in #15173 (which shipped in 3.7) but then the syntax was changed in #96579 and the same sort of mistake was added back (which shipped in 3.11).

This issue is also similar:

Linked PRs